pass value from R (run in SPSS) to open SPSS dataset -


completely new r here. ran r in spss solve complex polynomials spss datasets. managed result r spss, inelegant process:

begin program r. z  <- polyroot(unlist(spssdata.getdatafromspss(variables=c("qe","qd","qc","qb","qa"),cases=1),use.names=false)) othervals <- spssdata.getdatafromspss(variables=c("b0","b1","lc","tinv","sr","c0","c1","n2","xbar","dvxsq"),cases=1) b0<-unlist(othervals["b0"],use.names=false) b1<-unlist(othervals["b1"],use.names=false) lc<-unlist(othervals["lc"],use.names=false) tinv<-unlist(othervals["tinv"],use.names=false) sr<-unlist(othervals["sr"],use.names=false) c0<-unlist(othervals["c0"],use.names=false) c1<-unlist(othervals["c1"],use.names=false) n2<-unlist(othervals["n2"],use.names=false) xbar<-unlist(othervals["xbar"],use.names=false) dvxsq<-unlist(othervals["dvxsq"],use.names=false) z2 <- re(z[abs(c(abs(b0+b1*re(z)-tinv*sr*sqrt(1/(c0+c1*re(z))^2+1/n2+(re(z)-xbar)^2/dvxsq))-lc))==min(abs(c(abs(b0+b1*re(z)-tinv*sr*sqrt(1/(c0+c1*re(z))^2+1/n2+(re(z)-xbar)^2/dvxsq))-lc)))]) varspec1 <- c("xd","xd",0,"f8","scale") dict <- spssdictionary.createspssdictionary(varspec1) spssdictionary.setdictionarytospss("results", dict) new = data.frame(z2) spssdata.setdatatospss("results", new) spssdictionary.enddatastep( ) end program. 

honestly, pieced somewhat-related examples , seems more complicated should be. had take new dataset created r , run match files original dataset. want a) pull numbers spss r, b) manipulate them-in case, finding polyroot fit criteria- , , c) put results right spss dataset without messing of previous data.

am missing make more simple? keep in mind have 0 r experience outside of attempt, have decent experience in programming spss , matlab.

thanks in advance give!

r in spss can create new spss datasets, can't modify existing one. there lot of situations data r dimensionally inconsistent active spss dataset. need create dictionary , data frame using apis above , whatever appropriate on spss side if need match back. might want submit enhancement request spss @ suggest@us.ibm.com


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -