[R] Casting Date to char

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Wed Sep 5 22:54:50 CEST 2018


On Wed, 5 Sep 2018, Ben Tupper wrote:

> Perhaps you wanted to convert dp$rainfall.sampdate and not dp$sampdate like this...
>
> dp$sampdate <- as.character(dp$rainfall.sampdate)
>
> ... or even better, take charge of the conversion with format() ...
>
> dp$sampdate <- format(dp$rainfall.sampdate, format = '%Y-%m-%d')

Ben,

   Yep. That's what I want and didn't know how to do. The first conversion I
missed seeing and the second reflects my infamiliarity with format().

Many thanks,

Rich




More information about the R-help mailing list