$ R CMD SHLIB size.c
$ Rscript -e "dyn.load('size.so'); siz <- function(.) .Call( 'siz', .) ; siz(1:10); siz(siz); siz(letters) "
[1] 88
[1] 600
[1] 1496
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
#include <Rcpp.h> | |
// thanks to Simon for the macro magic | |
// problem #1: R internals uses "private" and "class" as | |
// member names. So a C++ compiler is confused | |
// when we include Connections.h | |
// this workaround uses the preprocessor to rename | |
// class as class_name and private as private_ptr | |
#define class class_name | |
#define private private_ptr |
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
#include <Rcpp.h> | |
using namespace Rcpp; | |
class B { | |
public: | |
B (SEXP b); | |
}; | |
template <class T> class A { | |
public: |
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
// Copyright (C) 2013 Romain Francois | |
// | |
// This file is part of Rcpp11. | |
// | |
// Rcpp11 is free software: you can redistribute it and/or modify it | |
// under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 2 of the License, or | |
// (at your option) any later version. | |
// | |
// Rcpp11 is distributed in the hope that it will be useful, but |
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
require(Rcpp) | |
sourceCpp( "dots.cpp" ) | |
x <- 1 | |
f <- function(...) { | |
x <- 2 | |
g(..., b = x) | |
} | |
g <- function(...) { |
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
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::export]] | |
NumericVector rowApply0(NumericMatrix& x, const Function& FUN) | |
{ | |
int n = x.nrow(); | |
NumericVector result = no_init(n); | |
for (int r = 0; r < n; r++) { |
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
#include <Rcpp.h> | |
using namespace Rcpp; | |
typedef SEXP (*CCODE)(SEXP, SEXP, SEXP, SEXP); | |
/* Information for Deparsing Expressions */ | |
typedef enum { | |
PP_INVALID = 0, | |
PP_ASSIGN = 1, | |
PP_ASSIGN2 = 2, |
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
#include <Rcpp.h> | |
using namespace Rcpp ; | |
template <typename T> | |
inline void set_item_impl( List& target, int i, const T& obj, CharacterVector& names, traits::true_type ){ | |
target[i] = obj.object ; | |
names[i] = obj.name ; | |
} | |
template <typename T> |
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
#include <Rcpp.h> | |
using namespace Rcpp ; | |
template <typename T> | |
inline void set_item_impl( List& target, int i, const T& obj, CharacterVector& names, traits::true_type ){ | |
target[i] = obj.object ; | |
names[i] = obj.name ; | |
} | |
template <typename T> |
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
x = <0x1038ff8a0>, dataptr = <0x1038ff8c8> | |
x = <0x1038ff8a0>, dataptr = <0x1038ff8c8> | |
x = <0x1038ff8a0>, dataptr = <0x1038ff8c8> | |
x = <0x1038ff8a0>, dataptr = <0x1038ff8c8> | |
x = <0x1038ff8a0>, dataptr = <0x1038ff8c8> | |
x = <0x1038ff8a0>, dataptr = <0x1038ff8c8> | |
x = <0x1038ff8a0>, dataptr = <0x1038ff8c8> | |
x = <0x1038ff8a0>, dataptr = <0x1038ff8c8> | |
x = <0x1038ff8a0>, dataptr = <0x1038ff8c8> | |
x = <0x1038ff8a0>, dataptr = <0x1038ff8c8> |
OlderNewer