So I wrote a simple function which converts to the 'Date' datatype.
f_change_date <- function(column) {
column <- as.Date(column)
}
f_change_date(df$Date.of.Launch)
Nothing happens. I also tried this:
f_change_date <- function(df, column) {
column <- df %>% transmute(column = as.Date(column))
}
f_change_date(df, df$Date.of.Launch)
Nothing happens here too. But if I do the the as.Date operation outside of the function, then it works completely fine. For example:
df$Date.of.Launch <- as.Date(df$Date.of.Launch)
This works and change the datatype of df$Date.of.Launch. Am I writing functions wrongly?