piektdiena, jūnijs 05, 2009

Running R from SPSS

Calibration of weights in SPSS using SPSS Statistics-R Plugin 17.0.0 for Win32.

*** SPSS syntax.
begin program r.
library(sampling)
setwd("C:/Documents and Settings/MLiberts/My Documents/Personal/Iceland_SILC/files")
cal_var=read.delim("cal_var.txt")
cal_tot=read.delim("cal_tot.txt")
data=as.matrix(cal_var[,2:ncol(cal_var)])
dw=as.vector(cal_var[,1])
totals=as.vector(cal_tot[,1])
g=calib(data,dw,totals,method="linear",description=F)
write.table(g,"g.txt",row.names=F,col.names=F)
end program.

Nav komentāru: