I assume that prim, etc. are columns of your data frame, mydata. Ergo, the
error message "prim not found" as 'prim' etc. does not exist in the Global
environment.
exclude <- with(mydata, prim == -9, etc. ) should get what you want to
evaluate your second subset statement if I have understood corre
Thanks. YES the second call to subset is there, trying to use my failed
definition of "exclude". Read on..
On 2021/10/16 上午 09:35, Jeff Newmiller wrote:
I don't see a "second one". Looks like you forgot the subset function call?
On October 15, 2021 6:23:56 PM PDT, Steven Yen wrote:
The follo
I don't see a "second one". Looks like you forgot the subset function call?
On October 15, 2021 6:23:56 PM PDT, Steven Yen wrote:
>The following "subset command works. I was hoping the second would as
>well but it does not.
>
>My definition of exclude is rejected.
>
>Help please? Thanks.
>
> > m
The following "subset command works. I was hoping the second would as
well but it does not.
My definition of exclude is rejected.
Help please? Thanks.
> mydata<-subset(mydata,
+ prim>-9 & highsch>-9 & tert>-9 &
+ govt>-9 & nongovt>-9 &
+ m
What you are probably looking for is the %in% operator:
with(mydata, sum(table(X1[X2 %in% 5:8])))
Read up on how operations are vectorized and how variables are
recycled if not long enough
> x <- 1:10
> x == 1:2 # compares first two fine
[1] TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FAL
Hello-
I have some code that looks like this:
with(mydatalocal, sum(table(Service[Time==5:8])))
This is designed to add up the numbers of responses between the Time
codes 5 to 8 (which are integers and refer to quarters). Service is
just one of the variables, I'm just trying to count the number
6 matches
Mail list logo