Re: [R] Subset command

2021-10-15 Thread Bert Gunter
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

Re: [R] [External] Subset command

2021-10-15 Thread Steven Yen
Great. Thanks! On 2021/10/16 上午 09:38, Richard M. Heiberger wrote: the second command doesn't tell R that the variables are in the data.frame mydata. you will need exclude <- with(mydata, prim==-9 | etc) also you will need logical negation ! not arithmetic negation

Re: [R] Subset command

2021-10-15 Thread Steven Yen
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

Re: [R] [External] Subset command

2021-10-15 Thread Richard M. Heiberger
the second command doesn't tell R that the variables are in the data.frame mydata. you will need exclude <- with(mydata, prim==-9 | etc) also you will need logical negation ! not arithmetic negation - > -c(TRUE,FALSE) [1] -1 0 > as.logical(-c(TRUE,FALSE)) [1] TRUE

Re: [R] Subset command

2021-10-15 Thread Jeff Newmiller
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. > > >

[R] Subset command

2021-10-15 Thread Steven Yen
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  & +