[R] Subset command

Steven Yen @tyen @end|ng |rom ntu@edu@tw
Sat Oct 16 03:39:47 CEST 2021


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 <styen using ntu.edu.tw> 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.
>>
>>> mydata<-subset(mydata,
>> +                prim>-9     & highsch>-9  & tert>-9 &
>> +                govt>-9     & nongovt>-9  &
>> +                married>-9  & urban>-9    &
>> +                smhmyes>-9  & smhmno>-9   & smhmnoru>-9 &
>> +                workouts>-9 & seconhan>-9 & reliyes>-9)
>>
>>> exclude<-      prim==-9     | highsch==-9  | tert==-9 |
>> +                govt==-9     | nongovt==-9  |
>> +                married==-9  | urban==-9    |
>> +                smhmyes==-9  | smhmno==-9   | smhmnoru==-9 |
>> +                workouts==-9 | seconhan==-9 | reliyes==-9
>> Error: object 'prim' not found
>>> mydata<-subset(mydata,-exclude)
>> Error in eval(e, x, parent.frame()) : object 'exclude' not found
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list