Created
December 8, 2012 16:44
-
-
Save wush978/4240959 to your computer and use it in GitHub Desktop.
Demo of xts API with inline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(xts) | |
data(sample_matrix) | |
x <- as.xts(sample_matrix) | |
library(inline) | |
library(Rcpp) | |
f <- cfunction(sig=c(Rxts="Rxts"), Rcpp=TRUE, | |
includes=' | |
extern "C" { | |
#define class xts_class | |
#include "xts.h" | |
#include "xts_stubs.c" | |
#undef class | |
} | |
', cppargs=sprintf("-I%s/include", path.package("xts")), | |
body=' | |
BEGIN_RCPP | |
Rprintf("%d \\n", isXts(Rxts)); | |
throw std::logic_error("test"); | |
END_RCPP | |
') | |
f(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment