Re: [R] Conditionally replace multiple rows in a dataframe

2014-11-20 Thread Bert Gunter
Sorry, just noticed the typo: it's is.na() of course. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." Clifford Stoll On Thu, Nov 20, 2014 at 4:04 AM, Bert Gunter wrote: >

Re: [R] Conditionally replace multiple rows in a dataframe

2014-11-20 Thread Bert Gunter
No comment on whether Jeff's solution is correct or not, but for setting elements to NA, perhaps preferable, as it invokes the NA method for data frames -- see ?NA -- is: is,na(DF[ , c("value1","value2") ]) <- !DF$ToKeep (I would welcome comments from cogniscenti as to whether this is actually pr

Re: [R] Conditionally replace multiple rows in a dataframe

2014-11-19 Thread Jeff Newmiller
Hi. Your failure to post in plain text has nearly rendered your example code unusable. Please post in plain text, not HTML. Also, the ToKeep attribute was most of your example, yet was completely irrelevant. I recommend avoiding the variable name "df" as it is easily confused with the base func

[R] Conditionally replace multiple rows in a dataframe

2014-11-19 Thread Thiago V. dos Santos
Hi programming fellows, Please consider the following data frame: df <- structure(list(date = structure(c(1251350100.288, 1251351900,  1251353699.712, 1251355500.288, 1251357300, 1251359099.712), class = c("POSIXct", "POSIXt")), mix.ratio.csi = c(442.78316237477, 436.757082063885,  425.74287276124