I am having some trouble subsetting a time series object in r.
1.I imported a csv file into R as follows (after removing the date column in excel)
sz.bm.df <- read.csv('size_book_25.csv',header=T)
2.The csv file has 1038 rows and 25 columns, missing values are designated by -99.99
3.I then created a time series object with a custom date range as follows
szbm.ts.data <- ts(data=sz.bm.df,start=c(1926,7),frequency=12)
4.Now i would like to deal with the missing values problem (i am having problems with this). I would like to create a subset out of the time series object that starts from the last row on which we find -99.99 until the end of the original object. I tried the following to extract the dates on which missing values are to be found:
time(szbm.ts.data[which(szbm.ts.data==-99.99)])
however,instead of giving me a set of dates this gives me:
[1] 1 2 3 4 5 6 7 8 9 10 11 12
attr(,"tsp") [1] 1 12 1
what am i doing wrong here?
thank you for any help