Re: [R] Read SPSS v 18 .sav file

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Fri, 18 Jun 2010 11:36:40 -0400

On Jun 18, 2010, at 10:44 AM, David Winsemius wrote:

>
> On Jun 18, 2010, at 10:26 AM, Larry Hotchkiss wrote:
>
>> Hi,
>>
>> I repeatedly get an error when trying to read an SPSS v. 18 .sav
>> file into R.
>
> No, you did not get an error message.
>>
>>> require(foreign)
>> Loading required package: foreign
>>> femaleSPSS.dat <- read.spss("female-04-02-2010.sav")
>> Warning message:
>> In read.spss("female-04-02-2010.sav") :
>> female-04-02-2010.sav: Unrecognized record type 7, subtype 18
>> encountered in system file
>>>
>>
>> However, read.spss works for .sav files created in older versions
>> of spss.
>>
>> I did just reinstall foreign to be sure I have the latest version.
>> Does anyone know of an update that works?
>
> What makes you think it didn't work? It was _only_ a warning message
> after all. Have you looked at femaleSPSS.dat in your workspace?
>
> Had you done a search of the archives you would have found many such
> early discussions:
>
> RSiteSearch("Unrecognized record type 7, subtype 18 encountered in
> system file")

I realized looking at this that my standard operating procedure (these days) was to use RSiteSearch() as a way to get to the webpage, and then when I realize that it no longer actually looks at the archives of r-help to turn off all of the default settings and turn on all of the archive settings. I earlier tried to craft a substitute function that would send the site an r-help-centric request, but found that the search engine would not accept my guess at the correct parameters for the three time periods that I am generally finding useful material within:

R-help 2008-2009
R-help 2010-
R-help 2002-2007

I am aware that the sos package might be a more flexible set of tools, but I really like the RSiteSearch format. I've just looked at the code and it appears the functions settings have been updated. This would do the trick:
RSiteSearch("Unrecognized record type 7, subtype 18 encountered in system file", restrict=c("Rhelp10", "Rhelp08", "Rhelp02"), matchesPerPage = 100)

And now I have the facilities to make my desired function:

rhelpSearch <- function(string,

                    restrict = c("Rhelp10", "Rhelp08", "Rhelp02",  
"functions" ),
                    matchesPerPage = 100, ...)
           RSiteSearch(string=string,  restrict = restrict,   
matchesPerPage = matchesPerPage, ...)

#testing:
 > RHSrch("Unrecognized record type 7, subtype 18 encountered in system file")
# Succeeds

Thanks to whomever updated RSiteSearch.

David Winsemius, MD
West Hartford, CT



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 18 Jun 2010 - 15:38:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jun 2010 - 17:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive