[Rcpp-devel] xts inputs and outputs for Rcpp translation

Dirk Eddelbuettel edd at debian.org
Thu Feb 6 15:10:56 CET 2014


On 6 February 2014 at 13:54, Hideyoshi Maeda wrote:
| Furthermore, when trying to compile the function createXts(), by coping and
| pasting it into a file, and then Rcpp::sourceCpp(‘file.cpp’), given in the
| link (http://gallery.rcpp.org/articles/accessing-xts-api/), it provides the
| following error…
| 
| Error in dyn.load("/var/folders/cj/d05h2g2938q7yb5rhp9rwx800000gn/T//RtmpjfmSg9
| /sourcecpp_157729b6a1bf/sourceCpp_33663.so") : 
|   unable to load shared object '/var/folders/cj/d05h2g2938q7yb5rhp9rwx800000gn/
| T//RtmpjfmSg9/sourcecpp_157729b6a1bf/sourceCpp_33663.so':
|   dlopen(/var/folders/cj/d05h2g2938q7yb5rhp9rwx800000gn/T//RtmpjfmSg9/
| sourcecpp_157729b6a1bf/sourceCpp_33663.so, 6): Symbol not found:
| __ZNK4Rcpp7RObject4attrERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
|   Referenced from: /var/folders/cj/d05h2g2938q7yb5rhp9rwx800000gn/T//RtmpjfmSg9
| /sourcecpp_157729b6a1bf/sourceCpp_33663.so
|   Expected in: flat namespace
|  in /var/folders/cj/d05h2g2938q7yb5rhp9rwx800000gn/T//RtmpjfmSg9/
| sourcecpp_157729b6a1bf/sourceCpp_33663.so
| 
| Does anybody else get this?

Nope. Works fine here. If you're on a Mac, you may need to rebuild Rcpp
itself from source.

My quick check below

Dirk

R> sourceCpp("~/git/rcpp-gallery/src/2013-01-12-getting-attributes-for-xts-example.cpp")

R>   suppressMessages(library(xts))

R>   set.seed(42)

R>   n <- 20

R>   Z <- xts(100+cumsum(rnorm(n)), order.by=ISOdatetime(2013,1,12,20,21,22) + 60*(1:n))

R>   xtsAttributes(Z)
[1] "dim"         "index"       "class"       ".indexCLASS" "tclass"      ".indexTZ"    "tzone"      

R>   names(attributes(Z))
[1] "dim"         "index"       "class"       ".indexCLASS" "tclass"      ".indexTZ"    "tzone"      

R>   all.equal(xtsAttributes(Z), names(attributes(Z)))
[1] TRUE

R>   xtsIndex(Z)
 [1] "2013-01-12 20:22:22 CST" "2013-01-12 20:23:22 CST" "2013-01-12 20:24:22 CST" "2013-01-12 20:25:22 CST" "2013-01-12 20:26:22 CST"
 [6] "2013-01-12 20:27:22 CST" "2013-01-12 20:28:22 CST" "2013-01-12 20:29:22 CST" "2013-01-12 20:30:22 CST" "2013-01-12 20:31:22 CST"
[11] "2013-01-12 20:32:22 CST" "2013-01-12 20:33:22 CST" "2013-01-12 20:34:22 CST" "2013-01-12 20:35:22 CST" "2013-01-12 20:36:22 CST"
[16] "2013-01-12 20:37:22 CST" "2013-01-12 20:38:22 CST" "2013-01-12 20:39:22 CST" "2013-01-12 20:40:22 CST" "2013-01-12 20:41:22 CST"
R> 

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list