[R] Parsing a Date

Philip herd_dog @end|ng |rom cox@net
Sun Aug 2 18:24:24 CEST 2020


Below is some Weather Service data.  I would like to parse the forecast date field into four different columns:

    Year
    Month
    Day
    Hour

I would like to drop the final four zeros.  Any suggestions?

forecast.date                 levels      lon           lat         HGT      RH          TMP       UGRD    VGRD
1 2020-08-01 12:00:00 1000 mb -113.130 33.6335 75.5519 49.6484 305.495 1.40155 2.23264
2 2020-08-01 12:00:00 1000 mb -113.111 33.5142 75.9582 51.0234 305.245 1.65155 2.23264
3 2020-08-01 12:00:00 1000 mb -113.092 33.3948 76.3957 52.7734 305.057 1.90155 2.23264
4 2020-08-01 12:00:00 1000 mb -112.987 33.6495 75.9269 49.1484 305.745 1.90155 2.04514
5 2020-08-01 12:00:00 1000 mb -112.968 33.5301 76.3019 50.2734 305.495 2.08905 1.98264

Philip Heinrich



	[[alternative HTML version deleted]]



More information about the R-help mailing list