I would like to convert date columns (Date, POSIXct, POSIXt) into character columns in a data frame. For example, I have this data frame.
df <- data.frame(date = Sys.Date(), time = Sys.time(), val = 1)
I can easily use the manual way like this to convert date columns into character columns.
df$date <- as.character(df$date)
df$time <- as.character(df$time)
Is there any way that I can convert them in a whole without specifying the date columns one by one? How could I convert them using lapply or sapply function?