Re: [R] Help with the Cut Function

2016-06-25 Thread David Winsemius
> On Jun 25, 2016, at 4:24 PM, Shivi Bhatia wrote: > > Hi David, > > I tried as suggested however with this code: > Age11<- cut(desc$Age, breaks = c(-Inf, 20,30,40,Inf),labels = > c("Low","Mid","Top")) Read the error message and add in another item to the 'labels' vector. Perhaps: c( "<=

Re: [R] Help with the Cut Function

2016-06-25 Thread Shivi Bhatia
Hi David, I tried as suggested however with this code: Age11<- cut(desc$Age, breaks = c(-Inf, 20,30,40,Inf),labels = c("Low","Mid","Top")) i receive an error message as below: lengths of 'breaks' and 'labels' differ. Now as a result i have values exceeding 40 as N/A. On Sun, Jun 26, 2016 at 3:25

Re: [R] Help with the Cut Function

2016-06-25 Thread David Winsemius
> On Jun 25, 2016, at 12:05 PM, Shivi Bhatia wrote: > > Dear Team, > > Please see the code below: > > Age1<- cut(desc$Age, breaks = c(20,30,40,Inf),labels = c("Low","Mid","Top")) Try instead: Age1<- cut(desc$Age, breaks = c(-Inf, 20,30,40,Inf),labels = c("Low","Mid","Top")) Do note that va

[R] Help with the Cut Function

2016-06-25 Thread Shivi Bhatia
Dear Team, Please see the code below: Age1<- cut(desc$Age, breaks = c(20,30,40,Inf),labels = c("Low","Mid","Top")) here i am creating three categories as mentioned from the age var from desc data set. All the values are set correctly however the values which are below 20 are set to NA. Is there a