[R] table function
    Glen Sargeant 
    gsargeant at usgs.gov
       
    Mon Aug 24 18:31:40 CEST 2009
    
    
  
Inchallah Yarab wrote:
> 
> i want to do a table summerizing the number of variable where z is in
> [0-1000],],[1000-3000], [> 3000]
> 
You can use "cut" to create a new vector of labels and tabulate the result. 
Options control closed/open endpoints (see ?cut):
> z <- c(100,1500,1200,500,3500,2000,4500)
> table(cut(z,c(0,1000,3000,max(z))))
      (0,1e+03]   (1e+03,3e+03] (3e+03,4.5e+03] 
              2               3               2 
-- 
View this message in context: http://www.nabble.com/table-function-tp25118909p25119226.html
Sent from the R help mailing list archive at Nabble.com.
    
    
More information about the R-help
mailing list