[R] How do I delete a row from a data frame when varA == "TRUE"
kxk
kkong at u.washington.edu
Wed Jul 22 06:24:20 CEST 2009
I want to delete a row from a data frame XYZ where A == "TRUE". Let's assume
there are five variables in this data frame XYZ. My deletion is based on
the TRUE vs. FALSE value under variable A. How do I do this? Thanks!
My current code:
for (i in 1:length(XYZ$A)) if (XYZ$A == "FALSE") XYZ<-XYZ else XYZ<-
XYZ[-i,]
Error message is:
Error in if (XYZ$A == "FALSE") XYZ<-XYZ else XYZ<- XYZ[-i, :
missing value where TRUE/FALSE needed
Please help!!
--
View this message in context: http://www.nabble.com/How-do-I-delete-a-row-from-a-data-frame-when-varA-%3D%3D-%22TRUE%22-tp24599876p24599876.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list