Hello Everyone,
I am trying to replace the values in the 2nd column (Variable 1) corresponding to certain dates (Date) with NAs as shown below. Both Date and Variable1 are numeric vectors . I am trying to use the transform function as shown below but it doesn’t seem to work even though if I am not getting any error Any suggestions/help in this regard? regards, --------------------------------------------------------------------------------------------------------------------------------------------------------- Df1 <- data.frame(Date, Variable1) a1 <- transform(Df1, ifelse(Date > "010301000300 " && Date < "010501000300", Variable1 ==NA, Variable1)) Original Data frame Date Variable1 010101000300 1 010201000300 2 010301000300 3 010401000300 4 010501000300 5 010601000300 6 010701000300 7 . . . ………. Transformed data frame (i hope to transform) Date Variable1 010101000300 1 010201000300 2 010301000300 NA 010401000300 NA 010501000300 NA 010601000300 6 010701000300 7 ………. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.