Hi, Paola,
This is good information!
Let's start with some basic checks. I'm going to use an example from the help(read.spss)
page.
library(foreign)
(sav <- system.file("files", "electric.sav", package = "foreign"))
#> [1] "/Library/Frameworks/R.framework/Versions/3.6/Resources/library/foreign/files/electric.sav"
dat <- read.spss(file=sav, to.data.frame=TRUE)
str(dat) # now a data.frame
#> 'data.frame': 240 obs. of 13 variables:
#> $ CASEID : num 13 30 53 84 89 102 117 132 151 153 ...
#> $ FIRSTCHD: Factor w/ 5 levels "NO CHD","SUDDEN DEATH",..: 3 3 2 3 2 3 3 3 2 2 ...
#> $ AGE : num 40 49 43 50 43 50 45 47 53 49 ...
#> $ DBP58 : num 70 87 89 105 110 88 70 79 102 99 ...
#> $ EDUYR : num 16 11 12 8 NA 8 NA 9 12 14 ...
#> $ CHOL58 : num 321 246 262 275 301 261 212 372 216 251 ...
#> $ CGT58 : num 0 60 0 15 25 30 0 30 0 10 ...
#> $ HT58 : num 68.8 72.2 69 62.5 68 68 66.5 67 67 64.3 ...
#> $ WT58 : num 190 204 162 152 148 142 196 193 172 162 ...
#> $ DAYOFWK : Factor w/ 7 levels "SUNDAY","MONDAY",..: NA 5 7 4 2 1 NA 1 3 5 ...
#> $ VITAL10 : Factor w/ 2 levels "ALIVE","DEAD": 1 1 2 1 2 2 1 1 2 2 ...
#> $ FAMHXCVR: Factor w/ 2 levels "NO","YES": 2 1 1 2 1 1 1 1 1 2 ...
#> $ CHD : num 1 1 1 1 1 1 1 1 1 1 ...
#> - attr(*, "variable.labels")= Named chr "CASE IDENTIFICATION NUMBER" "FIRST CHD EVENT" "AGE AT ENTRY" "AVERAGE DIAST BLOOD PRESSURE 58" ...
#> ..- attr(*, "names")= chr "CASEID" "FIRSTCHD" "AGE" "DBP58" ...
ls()
#> [1] "dat" "sav"
Created on 2020-01-04 by the reprex package (v0.3.0)
This tells us two things:
The dat
data frame (equivalent to your dataset
) has no field xfull
, so SPSS don't include that by default. Second, there is nothing in the global environment that ls()
shows as anything other than the objects, sav
and dat
that we have specifically created. Try the same with dataset
in a fresh session to confirm that is the case.
I also took a look at help(rfit)
. Interesting fact: Kloke is a co-author! There's no mention of an xfull
parameter. A bit of Googling, however, suggests that xfull
is actually a SPSS function
to create a matrix. This is a term also used in some R
packages.
So, I think that you have found the correct solution with
model <- rfit (Y ~A+ B + X +Z, data=dataset)
for two reasons:
- it gives you the expected result
- it's a well formed
formula
in R
regression usage
Kloke has a new text: Nonparametric Statistical Methods Using R (Chapman & Hall/CRC The R Series) 1st Edition by John Kloke (Author), Joseph W. McKean (Author) specifically using R.
The best I can offer is that if the results are similar to the example from the help(rfit)
page, you have probably understood the function.
The reprex
problem could be that you are behind a firewall or your default repository is down. Try
install.packages("reprex", repos='http://cran.rstudio.com/', ask=FALSE, checkBuilt=TRUE)