Guys I've been trying to change dates given in character form to a date , but I keep getting the wrong answers or an error. This is the structure of my data: Classes ‘data.table’ and 'data.frame': 2880 obs. of 9 variables:
$ Date : chr "1/2/2007" "1/2/2007" "1/2/2007" "1/2/2007" ...
$ Time : chr "00:00:00" "00:01:00" "00:02:00" "00:03:00" ...
$ Global_active_power : num 0.326 0.326 0.324 0.324 0.322 0.32 0.32 0.32 0.32 0.236 ...
Below is what I've tried so far
Trial$Date <- as.Date(Trial$Date, "%d/%m/Y") #this gives me NAs
Trial$Date <- as.Date.character(Trial$Date, "%d/%m/Y") #this gives me an error(Error in format.default(x, ...) : invalid 'trim' argument)
please advice. Thanks