Before we start the course, we have to install three things:
Download RStudio on the RStudio Website (Link). It’s free!
Those datapoint dots can be reassembled into narratives that suit the goals of the reassembler. As has been proven in many a grad-school psych project and as sung by Paul Simon in the key of B major, 'A man hears what he wants to hear and disregards the rest.' And there will be many, many dots for those narrative builders to choose from. I'm having issues compiling bigdecimal 1.2.5 on Mac OS X 10.10.1 (14B25). I use rbenv 0.4.0 for managing Ruby. I've uninstalled all my ruby versions and gems to no avail.
As a prerequisite for this guide, you need to have a few essential R packages installed.
Package | Description |
---|---|
lavaan | A sophisticated and user-friendly package for structural equation modeling |
ggplot2 | A flexible and user-friendly package for making graphs |
tidySEM | Plotting and tabulating the output of SEM-models |
semTools | Comparing models, establishing measurement invariance across groups |
psych | Descriptive statistics |
foreign | Loading data from SPSS ‘.sav’ files |
readxl | Loading data from Excel ‘.xslx’ files |
4. To install these packages, we use the install.packages()
function in R. One package after another, our code should look like this:
Don’t forget to put the package names in '
. Otherwise, you will get an error message.
To keep all your work organized, you should use a project. In Rstudio, click on the New project button:
In the pop-up dialog, click New directory, and again New project.
type the desired directory name in the dialog (give it a meaningful name, e.g. “TCSM_course”), and use ‘Browse’ if you need to change the directory where you store your projects. Now, in your project, click File > New file > R script. This script file works just like notepad, or the syntax editor in SPSS: You type plain text, but you can run it any time you want. Conduct all of the exercises in this script file.
Throughout the guide, a consistent set of conventions is used to refer to code:
sum()
or mean()
.seTE
or method.tau
.lavaan::sem()
. This is valid R code and will run. The lavaan::
part indicates that the function sem()
comes from the package lavaan
.As you start to apply the techniques described in this guide to your data you will soon find questions that the guide does not answer. This section describes a few tips on how to get help.
?
followed by the name of the function, e.g.: ?aov
. I have been using R for 10 years, and I still press F1 all the time to see how a function works.Sys.setenv(LANGUAGE = 'en')
and re-run the code; you’remore likely to find help for English error messages.)