Hello, Can you post sample data? Please post the output of
dput(head(inflation.2$period)) Hope this helps, Rui Barradas Às 18:42 de 28/09/2022, Admire Tarisirayi Chirume escreveu:
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<-read.csv("Inflation_forecasts_1.csv") attach(inflation) inflation[,1:2 ] #subsetting the dataframe inflation.df<-inflation[,1:2] attach(inflation.df) #Renaming variables inflation<- rename(inflation.df, cpi = CPI, year=period) #subsetting data April 2020 to current inflation.2<-data.frame(inflation[-c(1:135),]) ####Defining variables for use in the analysis attach(inflation.2) t <- year class(inflation.2$cpi) 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. Admire Alternative email: addtar...@icloud.com/tchir...@rbz.co.zw Skype: admirechirume Call: +263773369884 whatsapp: +818099861504 ______________________________________________ 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.