I have the following data:
library(tidyverse)
d1 <- data_frame(
time= c("1899-12-31 02:21:00 UTC", "1899-12-31 05:56:00 UTC"),
number = c(1, 2))
I would like to be able to covert the time variable to be in minutes in a new column so that the dataframe looks like this:
d1 <- data_frame(
time= c("1899-12-31 02:21:00 UTC", "1899-12-31 05:56:00 UTC"),
number = c(1, 2),
minutes = c("141", "356"))
I can do this using lubridate if my time variable is 02:21:00 and 05:56:00 however when I'm using read_excel() to load in the data it's turning my variable into POSIXct, eg 1899-12-31 02:21:00 UTC and 1899-12-31 05:56:00 UTC which is making it hard to convert.
I need to use read_excel() to read the data in so it's not an option to convert to a .csv and do it that way (which would stop it reading it as a POSIXct).
 
    