[R] Classification by range

David Winsemius dwinsemius at comcast.net
Thu Mar 8 21:54:48 CET 2012


On Mar 8, 2012, at 3:14 PM, Ajay Askoolum wrote:

> Given
>
> studentNumbers<-10;
>
> subjEnglish<-sample(-1:100,studentNumbers,replace=TRUE);
>
> when subEnglish <=0, 'U'
>                         <=39, 'F'
>                         <=49 'D'
>                         <=59, 'C'
>                         <=69, 'B'
>                         <=79,'A'
>                         <=100 'A+'
> I can solve this using a series of 'if' 'else' statements. I am  
> looking for a simple expression that will give the letter  
> classification for every element of subEnglish.

?cut

(This should be explained and exemplified in any introductory material  
regarding R.)

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list