Re: [R] Strange data frame behavior

2012-09-24 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Raoni Rodrigues > Sent: Tuesday, September 25, 2012 7:22 AM > To: r-help@r-project.org > Subject: [R] Strange data frame behavior > > Hello all, &

Re: [R] Strange data frame behavior

2012-09-24 Thread Jeff Newmiller
This has nothing to do with data frames and everything to do with how factors behave. The levels of a factor are not necessarily linked with the content of the factor. For example, a factor representing "Male" and "Female" has both of those levels even if all the data in a subset represents "Ma

[R] Strange data frame behavior

2012-09-24 Thread Raoni Rodrigues
Hello all, I don't understand a strange behavior in data frame manipulation. data_frame1 = data.frame(Site = c("S1", "S2", "S3", "S4", "L1", "L2", "L3", "L4"), Number = c(1, 3, 5, 2, 1, 1, 2, 1)) data_frame2 = data_frame1 [data_frame1$Site != "S1", ] dput