-1
I have this database and I intend to create a new column with this structuring (see image). For example, if the row in the Calendar_week column has a value between 36 and 45 the new Quartile column is supposed to have the number "1".
datanew1$Quartile <- case_when(
datanew1$Calendar_Week == seq(36,45) ~ "1",
datanew1$Calendar_Week == seq(46,52)+seq(1,5) ~ "2",
datanew1$Calendar_Week == seq(6,16) ~ "3",
datanew1$Calendar_Week == seq(17,27) ~ "4"
)
The problem is that the code is giving me a mistake :
"1: In datanew1$Calendar_Week == seq(36, 45) :
longer object length is not a multiple of shorter object length
2: In seq(46, 52) + seq(1, 5) :
longer object length is not a multiple of shorter object length
3: In datanew1$Calendar_Week == seq(46, 52) + seq(1, 5) :
longer object length is not a multiple of shorter object length
4: In datanew1$Calendar_Week == seq(6, 16) :
longer object length is not a multiple of shorter object length
5: In datanew1$Calendar_Week == seq(17, 27) :
longer object length is not a multiple of shorter object length
Any ideas on how to fix this? Thank you!