I put your code into a file tmp.R and eliminated the need for a package by
compiling this to a shared object
R CMD SHLIB tmp.c
I'm then able to use a simple script 'tmp.R'
dyn.load("/tmp/tmp.so")
fullocate <- function(int_mat)
.Call("C_fullocate", int_mat)
int_mat <- rbind(c(5L, 6
Iñaki is right. This solves it.
Kudos to Martin Morgan too for paring down my reprex; I wasn’t aware of the
method with R CMD SHLIB that he kindly described.
Thanks also to Peter Dalgaard for having a crack at it. Very grateful to you
all.
> On 12 Sep 2020, at 04:16, Iñaki Ucar wrote:
>
> Hi
Hi,
In line 5, you are allocating a vector of length nc. Then, in line 12, you
are using nr as a limit, so if nr goes beyond nc, which is happening in
line 39, you are in trouble.
Iñaki
On Sat, 12 Sep 2020 at 03:30, Rory Nolan wrote:
> I want to write an R function using R's C interface that t
Hm, I'm getting rusty on my C skills, but you repeatedly use a pattern like
> while (row_num <= nr) {
>Rprintf("row_num: %i\n", row_num);
>SEXP row = PROTECT(C_int_mat_nth_row_nrnc(int_mat_int, nr, 2, row_num));
I wonder if there is a subtle difference between assignments and initialized
I want to write an R function using R's C interface that takes a 2-column
matrix of increasing, non-overlapping integer intervals and returns a list
with those intervals plus some added intervals, such that there are no
gaps. For example, it should take the matrix rbind(c(5L, 6L), c(7L, 10L),
c(20L