[R] Assigning entries to category

Charles C. Berry cberry at tajo.ucsd.edu
Wed Jun 30 18:27:58 CEST 2010



see

 	?cut
 	?interaction

HTH,

Chuck

On Wed, 30 Jun 2010, LogLord wrote:

>
> Hi,
>
> I have the following problem:
> I have a large dataframe where each row is specified by two numerical value
> (one 1:25 and the other one large specific number (e.g. 203043)). I have a
> list of 60 categories which are also assigned to one of the first numerical
> value (1:25) but have a range for the second numerical value  (e.g. 200020 -
> 208040) in two different columns.
>
> I want now to assign a category to each row in a new variable by testing for
> accordance to the first numerical value and overlap of the second numerical
> value with the range.
>
> For example:
> entry1 has numerical value 1 = 15 and numerical value 2 = 200050.
> This would be assigned to category3, which has a numerical value 1 = 15 and
> a range for numerical value 2 = 200000 - 201000.
>
> It would be great if any one could help me out with this.
>
> Thanks!
> -- 
> View this message in context: http://r.789695.n4.nabble.com/Assigning-entries-to-category-tp2272707p2272707.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



More information about the R-help mailing list