I kindly request for assistance to convert a Date variable from a character to be recognised as a date. I used the following command lines.
inflation<-read.csv("Inflation_forecasts_1.csv") attach(inflation) inflation[,1:2 ] #subsetting the dataframe #Renaming variables inflation<- rename(inflation.df, cpi = CPI, year=period) #subsetting data April 2020 to current inflation.2<-data.frame(inflation[-c(1:135),]) class(inflation.2$cpi) inflation.2$cpi <- as.numeric(as.character(inflation.2$cpi)) * format(as.Date(inflation.2$period), "%Y-%m")* Having ran the command lines above, the variable period in the attached csv file remains being read as a character variable. Kindly assist. Thank you. ______________________________________________ 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.