1.2 Import data
This section uses the raw depression
data set from the Afifi et.al. textbook.
library(ggplot2)
<- read.table("https://norcalbiostat.netlify.com/data/Depress.txt",
depress sep="\t", header=TRUE)
SPSS syntax will look similar like this:
GET DATA /TYPE=XLSX
/FILE='C:\path\to\file.xlsx'
/SHEET=name 'Name-of-Sheet'
/CELLRANGE=full
/READNAMES=on
/ASSUMEDSTRWIDTH=32767.
EXECUTE.
DATASET NAME DataSetExcel WINDOW=FRONT.
Reference on importing data into SPSS: https://libguides.library.kent.edu/SPSS/ImportData.
The absolute first thing you should do is to look at your raw data table. Are the column headers variable names? Did all the rows get read in? Are there any extra columns or rows included?
1.2.1 Renaming variable names for sanity sake
Turn all variable names to lower case. This is especially frustrating for R and STATA users where syntax is case sensitive. This is completely optional but helpful
names(depress) <- tolower(names(depress))
You should also rename any variable that has spaces or special characters in the name.