I have a dataset from 1966 to 2002, I want change the units(multiply values by 0.305) of some of the values in the dataframe from 1966/05/07 to 1973/01/27 and want the rest of the values to remain as they are.
I tried this --->>>
Comb_A01 <- Comb_A01 %>% mutate(A01 = ifelse(Date>= as.Date("1966/05/07", format="%Y/%m/%d") & Date <= as.Date("1973/01/27", format="%Y/%m/%d"), A01 * 0.305, A02))
but it stops multiplying at 1970/10/17
your example data doesnt include examples between 1970 and 1973, so your statement that multiplication stops happening cant be verified on your data.
Also what is A02 and how does it relate? unless A02 is a duplicate of A01, then the function is not leaving the rest of the values as they are, its putting in values from a different column.
I have a dataset from 1966/05/07 to 2002/05/07, where I am trying to multiply values between 1966/05/07 and 1973/01/27 with 0.305 to change the units of measurement. I am using the code below but it is giving me a warning message and the code stops running in 1971/01/15. What I am doing wrong?
1: In ifelse(Date >= as.Date("1966/05/07", format = "%Y/%m/%d") & Date <= :
Incompatible methods ("Ops.factor", ">=.Date") for ">="
2: In ifelse(Date >= as.Date("1966/05/07", format = "%Y/%m/%d") & Date <= :
Incompatible methods ("Ops.factor", "<=.Date") for "<="