Re: [R] Question about subset

2018-04-10 Thread Sebastien Bihorel
.org Sent: Monday, April 9, 2018 12:33:41 AM Subject: Re: [R] Question about subset Sent from my iPhone > On Apr 8, 2018, at 9:06 PM, Sebastien Bihorel > <sebastien.biho...@cognigencorp.com> wrote: > > Hi, > > The help page for subset states "subset: logical expr

Re: [R] Question about subset

2018-04-10 Thread Sebastien Bihorel
Thanks. That works great! > df <- data.frame(x=c(1,1,NA,NA,2), y=c('a','a','a','b','b'), > z=c(TRUE,FALSE,TRUE,FALSE,TRUE)) > cond1 <- 'x==1' > cond2 <- 'x==1 & z' > df x y z 1 1 a TRUE 2 1 a FALSE 3 NA a TRUE 4 NA b FALSE 5 2 b TRUE > subset(df, subset =

Re: [R] Question about subset

2018-04-08 Thread David Winsemius
Sent from my iPhone > On Apr 8, 2018, at 9:06 PM, Sebastien Bihorel > wrote: > > Hi, > > The help page for subset states "subset: logical expression indicating > elements or rows to keep: missing values are taken as false." > > Before I try to re-invent

Re: [R] Question about subset

2018-04-08 Thread Bert Gunter
Please read the "Details" section of the help file -- it essentially tells you what to do by directly using indexing; e.g. for a vector, index by: [is.na(subset) | subset] . Adjust as necessary for your data structure.Or look at the code of, e.g. subset.data.frame and create your own subset

[R] Question about subset

2018-04-08 Thread Sebastien Bihorel
Hi, The help page for subset states "subset: logical expression indicating elements or rows to keep: missing values are taken as false." Before I try to re-invent the wheel, I would like to know if one of the base or recommended packages would contain a variant of the subset function that

[R] question about subset and join ts object(s)

2008-01-10 Thread tom soyer
Hi, I have two questions about ts. (1) How do I subset a ts object and still preserve the time index? for example: x=ts(1:10, frequency = 4, start = c(1959, 2)) # the ts object x Qtr1 Qtr2 Qtr3 Qtr4 1959 123 19604567 196189 10 I don't want the

Re: [R] question about subset and join ts object(s)

2008-01-10 Thread Achim Zeileis
On Thu, 10 Jan 2008, tom soyer wrote: Hi, I have two questions about ts. (1) How do I subset a ts object and still preserve the time index? for example: x=ts(1:10, frequency = 4, start = c(1959, 2)) # the ts object x Qtr1 Qtr2 Qtr3 Qtr4 1959 123 196045

Re: [R] question about subset and join ts object(s)

2008-01-10 Thread tom soyer
Thanks Achim. Data manipulation in zoo and coerce back to ts. Sounds good! On 1/10/08, Achim Zeileis [EMAIL PROTECTED] wrote: On Thu, 10 Jan 2008, tom soyer wrote: Hi, I have two questions about ts. (1) How do I subset a ts object and still preserve the time index? for example: