Quantcast
Viewing latest article 17
Browse Latest Browse All 57

as.Date in R completely changes the years

I have a time-series dataset in csv format. The monthly data is from 4/1/1953 to 6/1/2017. I want to convert this into an xts object in R. I used the following codes to import the dataset and then convert into xts. However, after the conversion, my time index starts from 2019-01-01. I have attached a snippet of my xts object here for your convenience. 1: https://i.stack.imgur.com/URyzb.png

data<-read.csv("10year_3month_treas_Bond_eq_spread.csv", stringsAsFactors = F)data$DATE=as.Date(data$DATE,"%m/%d/%y")data<-as.xts(data[,-1], order.by = data[,1])

I will be grateful if you could help me fix this.


Viewing latest article 17
Browse Latest Browse All 57

Trending Articles