I haven't been successful in converting my colleagues to the world of R yet they wish to share collected data so that they may analyze it in SPSS. I know how to write to an SPSS file and it opens fine, but my problem is that it only includes the existing data - none of the variables I created within R. The procedure followed thus far: 1. Collect Data via online system 2. Online system provides .csv of collected data 3. Read .csv into R 4. Analyze data/create variables associated with analyses within R Now I want to know if there is a way to export the variables I've created within R into an SPSS-usable file. Thanks for your help! -Daniel [[alternative HTML version deleted]]
On Mar 26, 2012, at 1:59 PM, Strassburger, Daniel wrote:> I haven't been successful in converting my colleagues to the world > of R yet they wish to share collected data so that they may analyze > it in SPSS. > > I know how to write to an SPSS file and it opens fine, but my > problem is that it only includes the existing data - none of the > variables I created within R. > > The procedure followed thus far: > > > 1. Collect Data via online system > > 2. Online system provides .csv of collected data > > 3. Read .csv into R > > 4. Analyze data/create variables associated with analyses > within R > > Now I want to know if there is a way to export the variables I've > created within R into an SPSS-usable file.Isn't SPSS able to read either CSV or one of the several formats supported by functions in package 'foreign'? ?write.foreign Usage write.foreign(df, datafile, codefile, package = c("SPSS", "Stata", "SAS"), ...) -- David Winsemius, MD West Hartford, CT
Strassburger, Daniel <Daniel_Strassburger <at> baylor.edu> writes:> > I haven't been successful in converting my colleagues to the world of R yetthey wish to share collected data> so that they may analyze it in SPSS. > > I know how to write to an SPSS file and it opens fine, but my problem is thatit only includes the existing data -> none of the variables I created within R.Daniel, Apologies if this is too obvious, but have you appended the new variables that you have created in R to the original dataset before you export in SPSS or .csv format? This doesn't happen automatically in R. Somthing like: all.data <- data.frame (imported.data, created.variable1, created.variable2, etc) Michael Bibo Queensland Health