laresbernardo / lares

Analytics & Machine Learning R Sidekick
https://laresbernardo.github.io/lares/
233 stars 49 forks source link

issue with date format #19

Closed AntoineSoetewey closed 4 years ago

AntoineSoetewey commented 4 years ago

Hi Bernardo,

Thanks for this package!

I encounter an error with the date format. Here is my code :

today <- as.character(Sys.Date())
cv <- data.frame(rbind(
 c("PhD Student in Statistics", "UCLouvain", "Academic", "2017-09-01", today),
 c("MSc in Econometrics", "Maastricht University", "Academic", "2015-09-01", "2016-08-31"),
 c("MSc in Economics", "KULeuven", "Academic", "2013-09-01", "2015-01-01"),
 c("Faculty Exchange", "UIUC, USA", "Academic", "2014-08-01", "2014-12-31"),
 c("BSc in Economics", "UCLouvain", "Academic", "2010-09-01", "2013-08-31"),
 c("Teaching Assistant in Statistics", "UCLouvain", "Work Experience", "2017-09-01", today),
 c("Private Tutor in Statistics and R", " ", "Work Experience", "2019-01-01", today),
 c("Data Scientist Consultant", "Business & Decision", "Work Experience", "2016-09-01", "2017-07-31"),
 c("European Public Affairs Intern", "BNP Paribas", "Work Experience", "2015-04-01", "2015-07-31"),
 c("Audit Intern", "Deloitte Luxembourg", "Work Experience", "2015-01-01", "2015-03-31"),
 c("International Tennis Chair Umpire", "International Tennis Federation", "Extra", "2015-05-01", today)
))
colnames(cv) <- order

plot_timeline(event = cv$Role, 
              start = cv$Start,
              end = cv$End,
              label = cv$Place, 
              group = cv$Type,
              save = FALSE,
              subtitle = "Antoine Soetewey")

And here is the error :

Error: Invalid input: time_trans works with objects of class POSIXct only

It used to work in the past as you can see here. I tried to change the format of the start and end dates by using as.Date(), ymd() and as.POSIXct but it wasn't successful.

By any chance do you know how I can fix this issue?

Thanks in advance.

Best, Antoine

laresbernardo commented 4 years ago

Hi @AntoineSoetewey Thanks for getting in touch and letting me know about the error. There was a weird problem with the scale_x_datetime function and I just commented it. Let me know if that made the trick ;) Oh, and in your reproducible example above you missed the order vector, but don't worry! One more thing: on the "Private Tutor in Statistics and R" line I'd change " " for NA. Please, feel free to write back anytime. congrats on your great CV ;)

AntoineSoetewey commented 4 years ago

Thanks for fixing it, it works now ! And thanks also for your suggestion about NA.