[R] Treating NA in timeSeries package

Upananda Pani upananda.pani at gmail.com
Fri Sep 22 11:45:04 CEST 2017

Dear All,

I am facing problem with NA treatment in my financial time series data.

# data reading

aluminum = read.csv(file="alu.csv", header=T, sep=",")

fut = aluminum [,2]
spt = aluminum [,3]

# Missing Value Treatment (Linear Interpolation)
spt = interpNA(spt, method = c("linear"))
fut = interpNA(fut, method = c("linear"))

spt =spt[,1]

spt = interpNA(spt, method = c("linear"))
Error in interpNA(spt, method = c("linear")) : spt is not a tis object
> fut = interpNA(fut, method = c("linear"))
Error in interpNA(fut, method = c("linear")) : fut is not a tis object

Then i want to convert my data into time series as following
# Making Time Series
fut = ts(fut, start=c(2006,4), frequency=305)
spt = ts(spt, start=c(2006,4), frequency=305)

Would you please guide me what is the problem with my code?

With best regards,
Upananda Pani

More information about the R-help mailing list