I'm very sorry (I'm brand new), as I understand this has been posted a million times but I want to understand not only the answer, but which methodology I should be using as a best practice. I've clicked 10+ links on how to do this, but I seem to mess it up on my data.
I have 3 columns of data in my heartrate_seconds.csv (ID, Date, Value), my date column is comprised of both the time and date which I'd like to separate (Ex: 4/12/2016 7:22:50 AM)
so far the closest I've been is using
heartrate_timeanddate <- heartrate_seconds %>%
mutate(Time = as.character(Time)) %>%
separate(Time, into = c("Date", "Time"), sep = " ") %>%
mutate(Time = as.Date(Date))
but this results in my newly added Time column as a date, how do I change this?
Other methods I tried that failed very early:
heartrate_seconds_Time <- separate(heartrate_seconds = df, col = Time, into = c('Date, Time'), sep = ' ')
heartrate_time <- data.frame(heartrate_seconds, Time = c('Date','Time'))
heartrate_time$date <- as.Date(heartrate_time$all)
heartrate_time$date <- format(as.Date(heartrate_time$all), format ="%H:%M:%S")
heartrate_seconds %>%
separate(Time, into = c('Date, Time'), sep = '\\\\') %>%
select(Date, Time)
I feel I'm using other peoples methods from other posts incorrectly and it's just pushed me into further confusion. So I've come seeking clarity. Thank you so much!
All of this just because I couldn't import the .csv into SQL, which I probably could've fixed in the schema but 1 thing at a time I guess.