[R] Rows classification problem

Carlos Guerra carlosguerra.amb at gmail.com
Thu Mar 4 13:35:16 CET 2010


Dear all,

I have a table like this:

> a <- read.csv("test.csv", header = TRUE, sep = ";")
> a

         UTM         pUrb                    pUrb_class      
1      NF1885    20,160307         NA  
2      NF1886    51,965649         NA  
3      NF1893    26,009581         NA  
4      NF1894      3,141484         NA   
5      NF1895    64,296826         NA  
6      NF1896    14,174068         NA  
7      NF1897    40,985589         NA  
8      NF1898    34,054325         NA  
9      NF1899    20,657632         NA  
10    NF1982    54,712737         NA 
11    NF1983    56,016067         NA 
12    NF1984      5,977961         NA  

What I wanted to do is to obtain classified values for "pUrb_class" in relation to "pUrb" as if:

pUrb <20      ---  pUrb_class = 1
pUrb 20-40  ---  pUrb_class = 2
pUrb 40-60  ---  pUrb_class = 3
....

Can anyone help me?

Thanks in advance,
Carlos


More information about the R-help mailing list