Re: [R] factors and ops

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Fri 26 May 2006 - 18:54:12 EST

Try an ordered factor:

  subset(HR, ordered(Patient) > 214)

or

  HR$Patient <- ordered(HR$Patient)
  subset(HR, Patient > 214)

You might also check that it orders them in the way you want. ordered(HR$Patient) in the first case or just HR$Patient in the second case will display the data followed by the ordering.

On 5/26/06, Erin Hodgess <hodgess@gator.dt.uh.edu> wrote:
> Dear R People
>
> I have a variable which is an ID number that is a factor.
>
> I would like to look for ID numberbs that are greeater than
> a particular value.
>
> However, factors are a big ugly for these operations.
>
> I was messing with the HR data set from the SASmixed package.
>
> HR$Patient is a factor like that.
>
> Now if I used:
> subset(HR,as.integer(as.character(Patient)) > 214)
>
> that will work.
>
> If seems to me that there may be a better way.
> Is that true?
>
> R Version 2.3.0 Windows
>
> Thanks in advance!
>
>
> sincerely,
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: hodgess@gator.uhd.edu
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri May 26 18:58:52 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 26 May 2006 - 20:10:18 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.