Het probleem zit hem in de functie die je gebruikt. Als iets niet helemaal gaat zoals je verwacht, is het verstandig om de help pagina te raadplegen. Dit doe je door een vraagteken net voor de functienaam te plaatsen, dus in jouw geval:
?getDat
Je krijgt dan de hulppagina te zien, waar onder andere het volgende in staat:
Basic functons to make working with R easier for SPSS users: getData and getDat provide an easy way to load SPSS datafiles [...]
Usage
getData(filename = NULL, file = NULL, errorMessage =
"[defaultErrorMessage]", applyRioLabels = TRUE,
use.value.labels = FALSE, to.data.frame = TRUE,
stringsAsFactors = FALSE, silent=FALSE, ...)
getDat(..., dfName = "dat", backup = TRUE)
[...]
getData returns the imported dataframe, with the filename from which it was read stored in the 'filename' attribute.
getDat is a simple wrapper for getData() which creates a dataframe in the parent environment, by default with the name 'dat'. Therefore, calling getDat() in the console will allow the user to select a file, and the data from the file will then be read and be available as 'dat'. If an object with dfName (i.e. 'dat' by default) already exists, it will be backed up with a warning. getDat() therefore returns nothing.
Kortom: getData en getDat zijn niet hetzelfde. De 'ruwere', 'algemenere' versie geeft het dataframe terug, en die kun je dus gebruiken in combinatie met de toewijzings-operator (<-).
Dus, je zou dit kunnen doen:
tentamencasus_PB0202161722 <- getData("/Users/tiffanykip/Documents/Studie/OU/Statistieken/SPSS/databestanden/tentamencasus/PB0202161722.sav");
Dan slaat hij de data op in een dataframe dat "tentamencasus_PB0202161722" heet. Wat je ook kunt doen is:
getDat("/Users/tiffanykip/Documents/Studie/OU/Statistieken/SPSS/databestanden/tentamencasus/PB0202161722.sav", dfName = 'tentamencasus_PB0202161722');