STAT545-UBC / Discussion

Public discussion
38 stars 20 forks source link

Times is R #363

Closed kmcmahen closed 8 years ago

kmcmahen commented 8 years ago

I was making a data frame for homework 4, and included some times in it (see below). The default in R is to output the times in seconds. I unsuccessfully have tried some options for editing the time format to h:m using as.Date and as.POSIXct, but couldn't figure out how to do it for just time (with no dates).

Also, if I was able to find a way to convert it, where would I put that code when manually entering the data as below (or as data <- c1 = (8:00, 9:00, 7:00))?

Thanks!

grocerystores <- " store, opening_time, open_Sundays No Frills, 9:00, yes Save On, 7:00, yes Costco, 8:00, yes Whole Foods, 9:00, no Safeway, 8:00, yes "

jennybc commented 8 years ago

The dates and times chapter of R for Data Science should be really helpful for this.

kmcmahen commented 8 years ago

Thanks, I was able to figure it out. For the reference of anyone else fighting with times that don't have a date attached, I recommend checking out the hms package.