Questions tagged [r-extension]

R is an open source programming language designed for statistical computing. The language is designed to be extensible via plugins written in C or C++. This tag is meant for questions about the extension interface.

is an open source programming language designed for statistical computing. An extension of the language is a program written in either or which makes use of R's API. The extensions can change default behavior of the language or add additional features and behaviors.

More information about writing extensions can be obtained from:

Related tags:

9 questions
6
votes
2 answers

Seeding a user supplied random number generator in R

I'm having some trouble with seeding a user defined RNG in R. It seems that set.seed(123, kind='user', normal.kind='user') Does not actually pass 123 to the user defined RNG initialization. I went back to the documentation available at ?Random.user…
GjjvdBurg
  • 478
  • 3
  • 14
5
votes
2 answers

How to return a named VECSXP when writing R extensions

Recently I had a bug and when fixing it I wondered if it is possible to return a VECSXP (i.e. an R list type), where the elements are named. This c++ code: SEXP do_bla() { int prtCnt = 0; SEXP a = PROTECT(allocMatrix(REALSXP, 5, 5)); …
user1972382
4
votes
1 answer

Change size of vector with R's C API

I'm allocating an R vector using allocVector in a C function called with .Call from R. Is it possible to change the size/length of the vector after it has been allocated? I.e., similar to how realloc works in C. In code, I'm looking for a function…
Fredrik Savje
  • 565
  • 2
  • 14
1
vote
0 answers

r extension netlogo, object 'economicvalue' not found

I am working in netlogo on a model which has to communicate with R during the run. I do this using the r extension in netlogo (so not Rnetlogo in R). at the setup I load my script with r:eval…
Wessel K
  • 55
  • 6
1
vote
1 answer

Calling the original function after tweaking arguments is an incorrect use of the R-API?

I am trying to create a small extension for R here for embedding the current time on the R prompt: https://github.com/musically-ut/extPrompt Things seem to be working overall, but R CMD check . raised a warning: File…
musically_ut
  • 34,028
  • 8
  • 94
  • 106
0
votes
0 answers

Cannot find R for creating R terminal. Change setting r.rterm.linux to R path.?

I have installed the R extension properly even though it is popping up as like this "Cannot find R for creating R terminal. Change setting r.rterm.linux to R path" and I also changed the path of the extension but also there is no proper outcome when…
0
votes
1 answer

How to create a RAWSXP vector from C char* ptr without reallocation

Is there a way of creating a RAWSXP vector that is backed by an existing C char* ptr. Below I show my current working version which needs to reallocate and copy the bytes, and a second imagined version that doesn't exist. // My current slow…
esiegel
  • 1,773
  • 2
  • 19
  • 31
0
votes
1 answer

What is the size limit for .r file extension size?

What is the max file size limit for .r extension file now? I read that it has 5MB limit, is it still the same? How does that change, will it be different from OS to OS or R version to version. Reference: RStudio maximum file size reached I'm very…
0
votes
1 answer

R extension write local data

I am creating a package and would like to store settings data locally, since it is unique for each user of the package and so that the setting does not have to be set each time the package is loaded. How can I do this in the best way?
Héctor van den Boorn
  • 1,218
  • 13
  • 32