[R] Converting Character date to Dates in r
drj|m|emon @end|ng |rom gm@||@com
Wed Sep 28 23:28:39 CEST 2022
Your attachment didn't get through, although CSV format should. The
code you included seems a very roundabout way to extract a series of
dates as character strings and as there is no assignment of return
values in some lines, is unlikely to work. Perhaps if you send just a
few of the original strings, someone can answer your question.
On Thu, Sep 29, 2022 at 4:02 AM Admire Tarisirayi Chirume
<atchirume using gmail.com> wrote:
> Hello, i hope this email finds you well. Kindly help me to format dates
> shown as character to dates using as.Dates.
> Attached herewith is my data in excel csv format.
> The following is the r-code i have used in my analysis:
> setwd("Z:/2022/September/Inflation forecasts")
> inflation[,1:2 ] #subsetting the dataframe
> #Renaming variables
> inflation<- rename(inflation.df,
> cpi = CPI,
> #subsetting data April 2020 to current
> ####Defining variables for use in the analysis
> t <- year
> inflation.2$cpi <- as.numeric(as.character(inflation.2$cpi))
> Y <- cpi
> sapply(inflation.2, class)
> format(as.Date(inflation.2$period), "%Y-%m")
> Thank you in advance.
> Alternative email: addtarris using icloud.com/TChirume using rbz.co.zw
> Skype: admirechirume
> Call: +263773369884
> whatsapp: +818099861504
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help