[R] First time Rcpp user needs compiler help, I think

2012-10-15 Thread Jay Rice
I am trying to write a C++ function to be called from R and have never done this before. I have done the following: require(Rcpp) require(inline) src <- 'blahblahblah' fun <- cxxfunction(signature(a="numeric",b="numeric"),src,plugin="Rcpp") That last line generates the error message: Error in co

[R] error msg using na.approx "x and index must have the same length"

2012-10-11 Thread Jay Rice
Below I have written out some simplified data from my dataset. My goal is to interpolate Price based on timestamp. Therefore the closer a Price is in time to another price, the more like that price it will be. I want the interpolations for each St and not across St (St is a factor with levels A, B

[R] practical to loop over 2million rows?

2012-10-10 Thread Jay Rice
New to R and having issues with loops. I am aware that I should use vectorization whenever possible and use the apply functions, however, sometimes a loop seems necessary. I have a data set of 2 million rows and have tried run a couple of loops of varying complexity to test efficiency. If I do a v