Practicing with R and subsetting
For each lab, you should expect to download the lab’s files locally to your computer, and run them there. If you’re using https://rstudio.cloud/ instead of running things locally, the same instructions should work today.
Find the full list of labs here.
Below are instructions for the exercise corresponding to that tutorial.
In the first lab, we set the working directory to a specific folder where every lab for this class will live. If you don’t remember, look at the wiki page I’ve created on setting a working directory.
Check that you’re in the directory you expect by running getwd() (the parentheses should have nothing in them). Just copy and paste that into the console and hit return/enter.
If you haven’t already completed the tutorial, you can open it up by pasting the following lines to run in your RStudio console, which will open the tutorial.
library(psychRstats)
lab("01-intro-to-r")
Once you’ve completed the tutorial, return here for an exercise that you will turn in at the end of the lab. Make sure that you close the tutorial window. (If you’d like to keep it open, refer to this page on the wiki.)
This exercise gives you the opportunity to do the following:
You should have downloaded the exercises already. If not, click here.
Today’s file is called “02-lab.Rmd”. Either open the file (in R through the Files pane, or by double-clicking on the file in your file browser), or (if in the correct working directory) you should be able to open the file by running the following code:
library(psychRstats)
run_exercise("02-exercise")
A version of the document with solutions can be seen here.
For attribution, please cite this work as
Dainer-Best (2020, Sept. 7). psychRstats: Learning Statistics for Psychology in R: 02: Introduction to R: Exercises. Retrieved from https://jdbest.github.io/psychRstats/labs/02-intro-exercises/
BibTeX citation
@misc{dainer-best202002:,
author = {Dainer-Best, Justin},
title = {psychRstats: Learning Statistics for Psychology in R: 02: Introduction to R: Exercises},
url = {https://jdbest.github.io/psychRstats/labs/02-intro-exercises/},
year = {2020}
}