Re: converting factors into dates

85 views
Skip to first unread message

Garrett Grolemund

unread,
May 8, 2014, 9:58:44 AM5/8/14
to lubr...@googlegroups.com
Elisabeth,

ymd can only handle vector input. It looks like date is a data frame. You'll need to pass just the DurationPartner_1 column of date to ymd. 

You can extract this column as vector with

date$DurationPartner_1

and parse it with 

ymd(date$DurationPartner_1)

Cheers,
Garrett




On Thu, May 8, 2014 at 2:37 AM, Elisabeth Schubach <elisabeth...@gmx.de> wrote:
Dear lubridate-users,

I am new to lubridate and tried to convert factors into dates using the following command. However, I got the following error message:
> ymd(date)
[1] NA.
Warning message:
All formats failed to parse. No formats found. 
> str(date)
'data.frame': 1819 obs. of  1 variable:
 $ DurationPartner_1: Factor w/ 147 levels "","0000-00-00",..: 104 1 1 78 131 1 135 79 68 108 ...

I would appreciate your help.

Elisabeth

--
You received this message because you are subscribed to the Google Groups "lubridate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lubridate+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages