Displaying 3 results from an estimated 3 matches for "vec_2".
Did you mean:
vec2
2023 Apr 29
1
Forcing a PROTECT Bug to Occur
...rint out nonsense results because the unprotected memory got overwritten,
but I can't make either happen.
Here's my current code (all in R, using the inline package for simplicity):
> gctorture(TRUE)
> z = inline::cfunction(body="
SEXP vec_1 = Rf_ScalarInteger(99);
SEXP vec_2 = Rf_allocVector(VECSXP, 10);
SET_VECTOR_ELT(vec_2, 1, vec_1);
Rf_PrintValue(vec_2);
")
My thinking was that, with torture mode enabled, the allocation of vec_2
should ensure that vec_1 is collected, and then trying to put it into vec_2
and then print it would then fail. But it consis...
2023 Apr 30
0
Forcing a PROTECT Bug to Occur
...id). It doesn't make sense speculating more without reading the code,
instrumenting and possibly debugging, if you want to find out exactly
what is happening in your situation.
Tomas
> > z = inline::cfunction(body="
> ? ? SEXP vec_1 = Rf_allocVector(INTSXP, 100);
> ? ? SEXP vec_2 = Rf_allocVector(VECSXP, 3);
> ? ? SET_VECTOR_ELT(vec_2, 1, vec_1);
> ")
> > z()
> NULL
> Warning message:
> In z() : your C program does not return anything!
> > gctorture(TRUE)
> > z()
>
> ?*** caught segfault ***
> address 0x55a68ce57f90, cause '...
2002 Jun 18
5
insert number in vector
Hello R-users,
I need to create a vector inserting an 1 after each value of another vector.
For example:
vec1<-c(2,3,4)
I need to create a vector with the values 2,1,3,1,4
Does anyone know how create this vector without loops (vec1 could have 1000
elements)
Thank you,
Juan
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read