Skip to content
Back to formatted view

Raw Message

Message-ID: <200304222132.OAA04891@hivnet.ubc.ca>
Date: 2003-04-22T21:26:48Z
From: Jerome Asselin
Subject: converting to factor
In-Reply-To: <20030422160051.B69267-100000@exigence.rootnode.com>

?cut

#E.g.,
cut(c(2.5, 1.6, 3.2),c(-Inf,3,Inf))
#[1] (-Inf,3] (-Inf,3] (3,Inf]

See also the "labels" option of cut().

HTH,
J.

On April 22, 2003 02:14 pm, R. Sean Bowman wrote:
> hello,
>
> I have a list of numbers that I want to convert into factors
> representing ranges of values.  For example, if I have
>
> c(2.5, 1.6, 3.2)
>
> I might want a list of factors like
>
> c("<3", "<3", ">3")
>
> I think I can do this by writing a function and using apply, as.matrix,
> &c., but I'm looking for a nicer way.  Any help is greatly appreciated.
>
> Thanks!
> Sean
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help