[R] data dividing
bambus
sonja_lae at hotmail.com
Tue Oct 16 11:26:22 CEST 2012
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.
More information about the R-help
mailing list