# How to handle missing data in time series in R?

I have 5 years stock closing price of a company with some missing values in between (I having 1443 data points).

When I create timeseries object in R with frequency 365 it creates 1834 data points, R is imputing these missing values for timeseries object but can anyone help me how it is imputing them? like what formula is used? Also if i don't want to impute these missing values is it possible in R?

R command used:

st_ts = ts(stocks[,2],start = c(2010,1),end = c(2015,9),frequency = 365)


• Isn't the time series package already inputting missing data point for you? Or does it assume the last 397 are empty only? can you include a plot of this timeseries object in your question? – SRKX Oct 20 '15 at 8:18
• yes it does but how do i know what values and how it imputes for large datasets? – alily Oct 20 '15 at 8:32
• Hi SRKX yes i have looked in that object it is giving different values for different missing fields ,but i did not understand how i is imputing those values so i asked this question – alily Oct 20 '15 at 8:40
• ok so it seems the data are repeated, and it seems you're original set only has about 300 points... – SRKX Oct 20 '15 at 8:40
• ts is probably not the right package for you, have a look at this page for more info. – SRKX Oct 20 '15 at 8:46