Dear R users, I want to group the d values in classes. If I use this script I have a problem. classes <- function(x, n){ s <- seq(0, ceiling(max(x)), by = n) factor(n*findInterval(x, s), levels = s) } z<-sapply(tapply(t$d,t$plot,function(x) classes(t$d, 4)),table) z<-cbind(z)
Thank you! Initial data: nr x y d plot plotn xplot yplot 121 162 50.26989 46.230 55.00 1 NA NA NA 120 160 43.05703 41.096 12.50 2 NA NA NA 1211 162 50.26989 46.230 55.00 2 NA NA NA 143 130 48.29959 59.406 42.00 2 NA NA NA 144 131 49.56329 55.866 79.50 2 NA NA NA 145 161 55.20783 50.046 79.75 2 NA NA NA 146 163 55.51600 51.860 40.75 2 NA NA NA 147 164 58.28660 52.787 13.25 2 NA NA NA 92 200 46.71426 38.114 20.75 3 92 15 95 93 193 56.97232 39.945 77.75 3 93 25 95 -- --- Catalin-Constantin ROIBU Forestry engineer, PhD Forestry Faculty of Suceava Str. Universitatii no. 13, Suceava, 720229, Romania office phone +4 0230 52 29 78, ext. 531 mobile phone +4 0745 53 18 01 +4 0766 71 76 58 FAX: +4 0230 52 16 64 silvic.usv.ro [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.