I have some CSV files that only contains 1 row with all the time series data for a variable seperated by commas so it looks like a lot of "columns". Usually I can see it is the other way around (1 column with variables and data in "rows"). Can R use this? And if not is there a way to change this?

I try to use the xts. format to specify that it is time series I have subsetted the yen_sdr.csv to the amount of data I need in "yensdr" and am not sure if this should be used or not for xts.

yensdr <- read.table("yen_sdr.csv", sep = ",", header = TRUE,    
                 skip = 0, stringsAsFactors = FALSE)    
yensdr$Time <- as.Date(yensdr$Period, "%m/%d/%Y")    

yensdr.xts <- xts(yensdr[, 4:5], order.by = yensdr$Time)  

I want it to recognize my header as a date. These are currently like "X1996.Q1,X1996.Q2...X2018.Q4" so not sure if they will work

0 Answers