Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201919

Problem when I try to convert a data.frame string with date from "1996-04-22" => to "1996-04" in R (using as.Date and format functions )

$
0
0

I have a data frame with a some Dates, I have to convert a format "1996-04-22" to "1996-04" in R. I have the good conversion but not in data type Date and when I tried to convert this to data type Date, I get "NA" everywhere.

//meteo is my date frame and date is where the dates are stocked

What I do :

meteo$date = format(meteo$date, "%Y-%m") 
meteo$date = as.Date(meteo$date, format = "%Y-%m")

Viewing all articles
Browse latest Browse all 201919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>