[R] Assistance with data import from Statistica

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sun Feb 1 13:23:42 CET 2004


Uwe Ligges <ligges at statistik.uni-dortmund.de> writes:

> Steve Burgess wrote:
> > 
> > I am a new R user attempting to convert files from Statistica to R.  I
> > can export from Statistica to SPSS .por format, but not to the SPSS .sav
> > format.  Is there a procedure for easily accomplishing this, which will
> > allow me to keep variable short and long labels (big surveys LOTS of
> > time to replace all this work).
> > 
> > Many thanks for sharing your time and knowledge.
> 
> What about using a database? (or ASCII files if nothing else works...)

Action speaks louder than words:

> x <- read.spss("tate96.por")
> names(x)[1:10]
 [1] "ID"       "EMPLYEE"  "SMSKEY"   "SMSTZONE" "SMSSTATE" "SMSCNTY"
 [7] "SMSCD"    "SMSMSA"   "SMSREP"   "SMSSTRTA"
> attr(x,"variable.labels")[1:10]
                                        ID
              "Pre-election Respondent ID"
                                   EMPLYEE
             "Pre-election Interviewer ID"
                                    SMSKEY
                         "Sample Record $"
                                  SMSTZONE
                  "Pre-election Time Zone"
                                  SMSSTATE
            "Pre-election FIPS State Code"
                                   SMSCNTY
           "Pre-election FIPS County code"
                                     SMSCD
"Pre-election FIPS Congressional District"
                                    SMSMSA
              "Pre-election FIPS MSA Code"
                                    SMSREP
                                        ""
                                  SMSSTRTA
                                  "Strata"
> x <- read.spss("tate96.por")
> attr(x,"variable.labels")[1:5]
                            ID                        EMPLYEE
  "Pre-election Respondent ID"  "Pre-election Interviewer ID"
                        SMSKEY                       SMSTZONE
             "Sample Record $"       "Pre-election Time Zone"
                      SMSSTATE
"Pre-election FIPS State Code"
> levels(x[[4]])
[1] "Pacific"  "Mountain" "Eastern"  "Central"

...etc...

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list