Thanks.
S. Elison provided a similar but apparently more general solution (see other
post in thread).
- Original Message -
From: "David Winsemius"
To: "Sebastien Bihorel"
Cc: r-help@r-project.org
Sent: Monday, April 9, 2018 12:33:41 AM
Subject: Re: [R] Questio
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 = ifelse(is.na(eval(parse(te
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 the wheel, I would like to know if o
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 versi
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 would
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
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
> 196
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 1
8 matches
Mail list logo