An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101230/e79d1fce/attachment.pl>
drop observations
4 messages · Charlène Cosandier, David Winsemius, DrorD
On Dec 30, 2010, at 4:54 PM, Charl?ne Cosandier wrote:
Hi, I want to drop observations with value 0 from my data.frame "dta" for each of the two variables "c01" and "ctotale". How can I do that? Thanks
subset(dta, !( c01==0 | ctotale==0) ) ... remembering of course to assign this result to some appropriately named object.
Charl?ne Lisa Cosandier [[alternative HTML version deleted]]
-- David Winsemius, MD West Hartford, CT
Hi Charlene, Have you looked at:
?subset
dror
View this message in context: http://r.789695.n4.nabble.com/drop-observations-tp3168884p3168906.html Sent from the R help mailing list archive at Nabble.com.
On Dec 30, 2010, at 5:53 PM, David Winsemius wrote:
On Dec 30, 2010, at 4:54 PM, Charl?ne Cosandier wrote:
Hi, I want to drop observations with value 0 from my data.frame "dta" for each of the two variables "c01" and "ctotale". How can I do that?
And on second look I wonder if my translation from English to Boolean was correct. If you wanted to excluded any case with c01 == 0 or ctotal==0 then the code was correct, but if you wanted to exclude only case where both were zero, the code would be incorrect and the logical operator should be changed to "&".
Thanks
subset(dta, !( c01==0 | ctotale==0) ) ... remembering of course to assign this result to some appropriately named object.
Charl?ne Lisa Cosandier
David Winsemius, MD West Hartford, CT