[R-SIG-Finance] Weird problem with latest RQuantLib not working with QuantMod on R 2.13.1

Dirk Eddelbuettel edd at debian.org
Wed Sep 28 06:03:40 CEST 2011


Chandra already contacted me too (off-list) and Jeff and I will indeed look
into this.  But as a traceback() immediately shows, the code in quantmod
stumbles over a test where 'adjust' is used. This variable is set earlier if
unset -- and there seems to be a bad side-effect with a (namespace-protected)
function of that name in RQuantLib.

The easiest workaround for now is to ... simply specify adjust=TRUE (or FALSE
depending on what you want).

Here is an example (using littler's r, Rscript would work similarly):

  edd at max:~$ r -lquantmod,RQuantLib -e 'getSymbols("GOOG", from = "2011-05-01", to="2011-05-30", auto.assign = TRUE); print(head(GOOG))'

  Attaching package: 'utils'

  The following object(s) are masked from 'package:Rcpp':

      .DollarNames, prompt

  Error in if (adjust) { : argument is not interpretable as logical
  Execution halted

and by simply adding adjust=TRUE it all works, as it does when RQuantLib is
not loaded:

  edd at max:~$ r -lquantmod,RQuantLib -e 'getSymbols("GOOG", from = "2011-05-01", to="2011-05-30", auto.assign = TRUE, adjust=TRUE); print(head(GOOG))'
  
  Attaching package: 'utils'
  
  The following object(s) are masked from 'package:Rcpp':
  
      .DollarNames, prompt
  
             GOOG.Open GOOG.High GOOG.Low GOOG.Close GOOG.Volume GOOG.Adjusted
  2011-05-02    545.70    545.73   537.12     538.56     2133700        538.56
  2011-05-03    537.13    542.01   529.63     533.89     2081500        533.89
  2011-05-04    535.17    539.00   533.02     535.79     2117000        535.79
  2011-05-05    533.86    539.42   531.50     534.27     1997800        534.27
  2011-05-06    538.15    541.46   535.18     535.30     2056100        535.30
  2011-05-09    535.00    538.49   531.10     537.68     1948700        537.68
  edd at max:~$ 
  

Cheers, Dirk

-- 
New Rcpp master class for R and C++ integration is scheduled for 
San Francisco (Oct 8), more details / reg.info available at
http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php



More information about the R-SIG-Finance mailing list