[Rcpp-devel] Adding a foreign include file to the RcppExports.cpp file

2015-09-16 Thread John Merrill
I'm trying to build an R package which exposes functions which depend on Google's re2 library. In order to do that, I need to depend on /usr/local/include/re2.h. That's really easy in the main cpp files, since #include works The problem arises when I use compileAttributes() to generate an RcppEx

Re: [Rcpp-devel] Efficient DataFrame access by row & column

2013-02-19 Thread John Merrill
b 19, 2013 at 3:26 PM, Ken Williams wrote: > > > > From: John Merrill [mailto:john.merr...@gmail.com] > > Sent: Tuesday, February 19, 2013 5:24 PM > > To: Ken Williams > > Cc: Yan Zhou; Dirk Eddelbuettel; rcpp-devel@lists.r-forge.r-project.org > > Subject: Re: [Rcp

Re: [Rcpp-devel] Efficient DataFrame access by row & column

2013-02-19 Thread John Merrill
I'm a little puzzled by your question. Could you use a reference instead of instantiating a new copy? On Tue, Feb 19, 2013 at 3:19 PM, Ken Williams wrote: > > > > -Original Message- > > From: Yan Zhou [mailto:zhou...@me.com] > > Sent: Tuesday, February 19, 2013 5:10 PM > > To: Dirk Edde

Re: [Rcpp-devel] Splitting a matrix by its rows into a list

2013-02-18 Thread John Merrill
There is a sleazy hack which works, but wastes a fair amount of memory: take the transpose of the matrix in R, and use the fact that the columns of that transpose are the rows of the original. On Mon, Feb 18, 2013 at 5:37 PM, Dirk Eddelbuettel wrote: > > On 18 February 2013 at 17:02, Kevin Ushe

Re: [Rcpp-devel] Performance question about DataFrame

2013-02-17 Thread John Merrill
colname; > colname << < "X." << j; > col_names(j) = colname; > } > > > Davor > > > On 2013-01-18, at 3:25 PM, John Merrill wrote: > > Sure. I'll write something up for the gallery, but here's the crude > outline. >

Re: [Rcpp-devel] Performance question about DataFrame

2013-01-31 Thread John Merrill
3:21 AM, Romain Francois wrote: > Le 15/01/13 16:20, John Merrill a écrit : > > It appears that DataFrame::create is a thin layer on top of the R >> data.frame call. The guarantee correctness, but also means the >> performance of an Rcpp routine which returns a large data

Re: [Rcpp-devel] Rcpp Module problem: R crash

2013-01-21 Thread John Merrill
Have you tried running your code within a debugger? It's pretty straightforward to do that, either by building a package and loading the resulting library or by using sourceCpp. Here's a simple standard session using the following file (named '/tmp/zero_ref.cc' on my system) as input: #include

Re: [Rcpp-devel] Performance question about DataFrame

2013-01-18 Thread John Merrill
- replicate(250, 1:100, simplify=FALSE) > system.time(replicate( { as.data.frame(a) ; NULL }, n=100)) user system elapsed 3.890 0.000 3.892 > system.time(replicate( { BuildCheapDataFrame(a) ; NULL }, n=100)) user system elapsed 0.020 0.000 0.022 Yes, that really is a facto

Re: [Rcpp-devel] Performance question about DataFrame

2013-01-17 Thread John Merrill
utine which takes seconds. So, pragmatically, in Rcpp, I can get a rough factor of sixty, it appears. On Thu, Jan 17, 2013 at 7:46 PM, Paul Johnson wrote: > On Tue, Jan 15, 2013 at 9:20 AM, John Merrill > wrote: > > It appears that DataFrame::create is a thin layer on top of t

Re: [Rcpp-devel] Performance question about DataFrame

2013-01-15 Thread John Merrill
w. You must know that data.frame IS a list of variables, which can be > vectors (though not always) and can only be faster than a list of lists. > > Best, > > Yan > > > On Jan 15, 2013, at 03:20 PM, John Merrill wrote: > > It appears that DataFrame::create is a thin laye

[Rcpp-devel] Performance question about DataFrame

2013-01-15 Thread John Merrill
It appears that DataFrame::create is a thin layer on top of the R data.frame call. The guarantee correctness, but also means the performance of an Rcpp routine which returns a large data frame is limited by the performance of data.frame -- which is utterly horrible. In the current version of R, t

[Rcpp-devel] Is 10.1 intentionally stricter than 9.15?

2012-12-13 Thread John Merrill
I just built a source package on a 0.10.1 box for the first time; previously, I'd always built it on 0.9.15 boxes. I was surprised to see that I now need to do string comparisons to character SEXP's using the CHAR() macro; previously, I'd been able to use the SEXP from a StringVector directly. I'

Re: [Rcpp-devel] binding, combining vectors

2012-12-13 Thread John Merrill
What about 'concat', 'cat', or 'concatenate'? The function concatenates vectors, and 'concat' and 'cat' are well-known short forms of the word. (The Unix program 'cat' is so-named because it concatenates text files.) On Thu, Dec 13, 2012 at 7:20 AM, Walter Mascarenhas < walter.mascaren...@gmail

Re: [Rcpp-devel] Dynamically creating data.frame/list (of vectors)

2012-11-26 Thread John Merrill
There's a small issue with that -- if your columns contain any character lists, then those columns wind up being coerced into factors by as.data.frame (inside the constructor). You can work around that by either setting the default value of the stringsAsFactors option to FALSE, and then resetting

Re: [Rcpp-devel] Inline, templates, and easy debugging

2012-11-21 Thread John Merrill
r 2012 at 18:59, John Merrill wrote: > | Is there a way to do this using inline? > > Maybe. > > I tend to write packages. That is the way we documented, and still recommend. > > Dirk > > -- > Dirk Eddelbuettel | e...@debia

[Rcpp-devel] Inline, templates, and easy debugging

2012-11-21 Thread John Merrill
tl;dr summary -- is there a way to incorporate multiple functions into an inline call? Specifically, is there a way to include a templated function in an inline compilation? Consider the following outline: template void InsertTypedVector } RcppExport SEXP ExposedFunction(SEXP r_foobar) { Dat