hey I'd like to divide my data into four seasons. for this I made a function:
Jahreszeit <- function(x) { if (x<=02 || x==12) {return("Winter") }else{ if (x>=03 && x<=05) {return("Fruehling") }else{ if (x>=06 && x<=08) {return("Sommer") }else{ if (x>=09 && x<=11) {return("Herbst") }}}}} Now, I have some trouble to apply this function. I tried lapply(), sapply() and tapply() but everytime i get for every month just "Winter". which isn't right. Does someone now an explanation? if i try it with some random vector it does work but not with my data. Please, I need help...has anyone an idea? thx -- View this message in context: http://r.789695.n4.nabble.com/data-dividing-tp4646314.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.