[R] need help on read.spss

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Oct 13 16:22:21 CEST 2011



On 11.10.2011 12:07, Smart Guy wrote:
> Hi,
>        I have one doubt about one of the parameter of 'read.spss()' from
> 'foreign' package.
> Here is the syntax :-
>
> read.spss ( file,
>      use.value.labels = TRUE,
>      to.data.frame = FALSE,
>      max.value.labels = Inf,
>      trim.factor.names = FALSE,
>      trim_values = TRUE,
>      reencode = NA,
>      use.missings = to.data.frame )
>
>
> In above syntax when I pass *'to.data.frame= FALSE*' it gives me missing
> values from SPSS file (that I try to read using read.spss() ). But when I
> pass '*to.data.frame = TRUE*' then its not giving me missing values. And
> need to get missing values.
>
> According to read.spss() documentation
>
> *to.data.frame :  return a data frame?*
>
> I am curious to know, if we pass *'to.data.frame = TRUE*' , is it going to
> cause some issue or effect something? I didn't understand the read.spss()
> documentation correctly.
> Please explain.
>
> Thanks in Advance
>

An R data.frame cannot represent different kinds of missing values, 
since R just has "NA". Therefore, there are two way to import data:

to.data.frame=FALSE  will read all the information, but into a format 
you will likely have to postprocess to make it conveniently usable.

to.data.frame=TRUE   will import into a data.frame, but that cannot 
represent all the nuances known from the SPSS representation.

Uwe Ligges



More information about the R-help mailing list