Re: [R] truncating values into separate categories

2009-08-01 Thread David Winsemius
On Jul 31, 2009, at 2:55 PM, PDXRugger wrote: I must apoligize, as i want clear of what i wanted to occur. i dont want to count the occurences but rather recode them. I am trying to replace all of the values with the new coded values in Person_CAT. SO NP <- c(1, 1, 2, 1, 1, 2, 2,

Re: [R] truncating values into separate categories

2009-08-01 Thread PDXRugger
I must apoligize, as i want clear of what i wanted to occur. i dont want to count the occurences but rather recode them. I am trying to replace all of the values with the new coded values in Person_CAT. SO NP <- c(1, 1, 2, 1, 1, 2, 2, 1, 4, 1, 0, 5, + 3, 3, 1, 5, 3, 5, 1, 6, 1,

Re: [R] truncating values into separate categories

2009-07-31 Thread Albyn Jones
It appears that your difficulty lies in miscounting the number of intervals. cut(NP, breaks=c(0,1,2,3,4,max(NP))) [1] (0,1] (0,1] (1,2] (0,1] (0,1] (1,2] (1,2] (0,1] (3,4] (0,1] (4,6] (2,3] (2,3] (0,1] [16] (4,6] (2,3] (4,6] (0,1] (4,6] (0,1] (1,2] (1,2] (1,2] (3,4] (3,4] (0,1] (1,2] (0,1

Re: [R] truncating values into separate categories

2009-07-30 Thread Bill.Venables
Here is a suggestion: > Per <- c("NA", "1", "2", "3","4") > NP <- c(1, 1, 2, 1, 1, 2, 2, 1, 4, 1, 0, 5, + 3, 3, 1, 5, 3, 5, 1, 6, 1, 2, 2, 2, + 4, 4, 1, 2, 1, 3, 3, 1, 2, 2, 1, 2, 1, 2, + 2, 3, 1, 1, 4, 4, 1, 1, 1, 2, 2, 2) > Person_CAT <- cut(NP, breaks = c(0:4, Inf)-0.5, labe