This seems like a problem that others may have run into before. I got a merged dataset from SPSS. It has ~750 columns X 3400 rows. Most of the cell entries are NA. There are about 375 rows that contain observations on all variables and I want to extract this subset from the original list (of lists). I'm pretty sure I can do it programmatically in R but it will take me a few hours to write and debug. Before I start down that road I thought I'd ask if anyone had already tackled this particular type problem already. Thanks a lot, Mark Schultz
On Mon, 16 Dec 2002 SMarkandsusan at aol.com wrote:> This seems like a problem that others may have run into before. I got a > merged dataset from SPSS. It has ~750 columns X 3400 rows. Most of the cell > entries are NA. There are about 375 rows that contain observations on all > variables and I want to extract this subset from the original list (of > lists). I'm pretty sure I can do it programmatically in R but it will take me > a few hours to write and debug. Before I start down that road I thought I'd > ask if anyone had already tackled this particular type problem already.The na.omit() function removes rows from a dataframe that have any missing values. -thomas
..if i understand you correct that you wan't only the 375 rows with no NA in ~ 750 columns use: all.data <- read.spss("c:/yourData.sav",use.value.label=F,to.data.frame=T) all.validData <- na.omit(all.data) christian ----- Original Message ----- From: <SMarkandsusan at aol.com> To: <r-help at stat.math.ethz.ch> Sent: Monday, December 16, 2002 9:05 PM Subject: [R] Manipulating the output from read.spss> This seems like a problem that others may have run into before. I got a > merged dataset from SPSS. It has ~750 columns X 3400 rows. Most of thecell> entries are NA. There are about 375 rows that contain observations on all > variables and I want to extract this subset from the original list (of > lists). I'm pretty sure I can do it programmatically in R but it will takeme> a few hours to write and debug. Before I start down that road I thoughtI'd> ask if anyone had already tackled this particular type problem already. > Thanks a lot, > Mark Schultz > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help
use read.spss with to.data.frame=TRUE, then na.omit on the result. This assumes that the missing values are signes as such in spss, so read.spss imports them correctly. Kjetil Halvorsen SMarkandsusan at aol.com wrote:> > This seems like a problem that others may have run into before. I got a > merged dataset from SPSS. It has ~750 columns X 3400 rows. Most of the cell > entries are NA. There are about 375 rows that contain observations on all > variables and I want to extract this subset from the original list (of > lists). I'm pretty sure I can do it programmatically in R but it will take me > a few hours to write and debug. Before I start down that road I thought I'd > ask if anyone had already tackled this particular type problem already. > Thanks a lot, > Mark Schultz > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help