Displaying 1 result from an estimated 1 matches for "interpolatedprice".
2012 Oct 12
1
error msg using na.approx "x and index must have the same length"
...01-01 13:00:21.847 81.53
13 C 2012-01-01 13:00:21.860 81.53
14 C 2012-01-01 13:00:21.873 NA
15 C 2012-01-01 13:00:43.493 84.69
16 D 2012-01-01 12:01:21.520 24.63
17 D 2012-01-01 12:02:18.880 21.13
I tried the following using na.approx from zoo package
interpolatedPrice<-unlist(tapply(portfolio$Price, portfolio$St, na.approx,
portfolio$timestamp, na.rm=FALSE))
but keep getting error
"Error in na.approx.default(X[[1L]], ...) :
x and index must have the same length"
I checked the length of every variable in the formula and they all have the
same len...