Hi Jibrin, solar_wind_sps<-data.frame(sws=306,date="2021-016") solar_wind_spd solar_wind_spd$date<-as.Date(solar_wind_spd$date,"%Y-%j") solar_wind_spd
This changes the "date" field to an actual date object. If you just want to change a character string date to another format: solar_wind_spd$date<-format(as.Date(solar_wind_spd$date,%Y-%j),"%Y-%m-%d") Jim On Sat, Jan 16, 2021 at 4:55 AM Jibrin Alhassan <jibrin.alhas...@unn.edu.ng> wrote: > > Dear R users, > I am very new to R software. I have solar wind speed data needed for my > work. How do I convert day in the year to year, month, and day with R > software? I have used this code > as.Date(0, origin = "1998-01-01") > but it can only convert one day of the year at a time. Meanwhile, I have up > to the 1998-2002 data set. Attached is my data. > Kindly help, please. > Jibrin Alhassan > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.