search for: vecsxp

Displaying 20 results from an estimated 141 matches for "vecsxp".

2011 Aug 13
1
Latent flaw in SEXPREC definition
There seems to be a latent flaw in the definition of struct SEXPREC in Rinternals.h, which likely doesn't cause problems now, but could if the relative sizes of data types changes. The SEXPREC structure contains a union that includes a primsxp, symsxp, etc, but not a vecsxp. However, in allocVector in memory.c, zero-length vectors are allocated using allocSExpNonCons, which appears to allocates a SEXPREC structure. This won't work if a vecsxp is larger than the other types that are in the union in the SEXPREC structure. Simply adding a vecsxp to the union would...
2019 Jul 23
3
Any plans for ALTREP lists (VECSXP)?
Hello, I was wondering if there were any plans for ALTREP lists (VECSXP)? It seems to me that they could be supported in a similar way to how ALTSTRING works, with Elt() and Set_elt() methods, or would there be some problems with that I?m not seeing due to lists not being atomic vectors? I was taking an approach of converting each list element (of a file-based list d...
2019 Jul 23
0
Any plans for ALTREP lists (VECSXP)?
...ider deriving from S4Vector's List class, implementing the getListElement() method to lazily create the objects. Michael On Tue, Jul 23, 2019 at 9:09 AM Bemis, Kylie <k.bemis at northeastern.edu> wrote: > > Hello, > > I was wondering if there were any plans for ALTREP lists (VECSXP)? > > It seems to me that they could be supported in a similar way to how ALTSTRING works, with Elt() and Set_elt() methods, or would there be some problems with that I?m not seeing due to lists not being atomic vectors? > > I was taking an approach of converting each list element (of a...
2019 Jul 24
0
[External] Re: Any plans for ALTREP lists (VECSXP)?
...od to >> lazily create the objects. >> >> Michael >> >> On Tue, Jul 23, 2019 at 9:09 AM Bemis, Kylie <k.bemis at northeastern.edu> >> wrote: >>> >>> Hello, >>> >>> I was wondering if there were any plans for ALTREP lists (VECSXP)? >>> >>> It seems to me that they could be supported in a similar way to how >> ALTSTRING works, with Elt() and Set_elt() methods, or would there be some >> problems with that I?m not seeing due to lists not being atomic vectors? >>> >>> I was taking...
2010 Mar 11
1
Shrinking a List
Hello, I create a VECSXP(call it A) with size N(~ 5000), i then proceed to fill the elements and find out I don't need to fill more than M (M<< N). Thus if i return A to the user's R code, he/she will see a list of length 5K of which N-M are NULLs. To avoid this, I create a new VECSXP B of length M and /dupl...
2013 Jul 05
1
Get the tail of a list in C
Hi, I am write R extensions in C. Now I have a VECSXP variable, so how can I get the tail of it (all but the first one) as a new VECSXP. I tried CDR(), but it gives error. Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Get-the-tail-of-a-list-in-C-tp4670900.html Sent from the R devel mailing list archive at Nabble.com.
2018 Feb 01
2
as.list method for by Objects
...t stat.math.ethz.ch> wrote: >>>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>>> on Tue, 30 Jan 2018 15:57:42 -0800 writes: > > > I just meant that the minimal contract for as.list() appears to be that it > > returns a VECSXP. To the user, we might say that is.list() will always > > return TRUE. > > Indeed. I also agree with Herv'e that the user level > documentation should rather mention is.list(.) |--> TRUE than > VECSXP, and interestingly for the experts among us, > the is.list() pr...
2019 Jul 23
3
Any plans for ALTREP lists (VECSXP)?
...plementing the getListElement() method to > lazily create the objects. > > Michael > > On Tue, Jul 23, 2019 at 9:09 AM Bemis, Kylie <k.bemis at northeastern.edu> > wrote: > > > > Hello, > > > > I was wondering if there were any plans for ALTREP lists (VECSXP)? > > > > It seems to me that they could be supported in a similar way to how > ALTSTRING works, with Elt() and Set_elt() methods, or would there be some > problems with that I?m not seeing due to lists not being atomic vectors? > > > > I was taking an approach of conv...
2005 Nov 07
3
R thread safe
...of the OpenMP parallelization is a C SEXP function that performs the computational routine in parallel with: ******************* SEXP example(SEXP list, SEXP expr, SEXP rho) { R_len_t i, n = length(list); SEXP ans, alocal; omp_lock_t lck; PROTECT(ans = allocVector(VECSXP, n)); ans = allocVector(VECSXP, n); omp_init_lock(&lck); #pragma omp parallel for default(none) private(i, alocal) shared(list, lck,rho, ans, n, expr) for(i = 0; i < n; i++) { omp_set_lock(&lck); PROTECT(alocal = allocVector(VECSXP, 1));...
2019 Jul 24
1
[External] Re: Any plans for ALTREP lists (VECSXP)?
...; >> > >> Michael > >> > >> On Tue, Jul 23, 2019 at 9:09 AM Bemis, Kylie <k.bemis at northeastern.edu> > >> wrote: > >>> > >>> Hello, > >>> > >>> I was wondering if there were any plans for ALTREP lists (VECSXP)? > >>> > >>> It seems to me that they could be supported in a similar way to how > >> ALTSTRING works, with Elt() and Set_elt() methods, or would there be > some > >> problems with that I?m not seeing due to lists not being atomic vectors? > >>...
2016 Aug 05
2
Extra copies of objects in environments when using $ operator?
My understanding is that R will not make copies of lists if there is only one reference to the object. However, I've encountered a case where R does make copies, even though (I think) there should be only one reference to the object. I hope that someone could shed some light on why this is happening. I'll start with a simple example. Below, x is a list with one element, and changing that
2009 Mar 30
1
Setting the names attribute of a list?
...ght segfault *** address 0x5, cause 'memory not mapped' However, if i dont set the R_NamesSymbol, I do not get any such error. Am I doing this correctly? Thank you Saptarshi ==CODE=== // kxp and usar are two SEXP's which have not been protected SEXP res PROTECT(res); res= allocVector(VECSXP, 2); SET_VECTOR_ELT(res,0,kxp); SET_VECTOR_ELT(res,1,usar); names=allocVector(VECSXP,2);PROTECT(names); //A SET_VECTOR_ELT(names, 0, mkChar("key")); //A SET_VECTOR_ELT(names, 1, mkChar("value")); //A setAttrib(res, R_NamesSymbol,names); //A UNPROTECT(2); return(res); Saptarsh...
2005 Jun 29
1
Viewing R objects in gdb
...hat an example in the R Extensions manual section 4.11.2 "Inspecting R objects when debugging" does, but the code there doesn't work, presumably because the R internals have changed since it was written. Specifically, I get (gdb) p $a->u.listsxp.tagval->u.symsxp.pname->u.vecsxp.type.c Error: There is no member named vecsxp. where $a was set to be the attrib member of an SEXP. Could someone let me know what needs to be fixed for this to work? I imagine it's a typecast, but I haven't been able to put it together. (An example using R_PV to print the attributes o...
2018 Jan 30
2
as.list method for by Objects
I just meant that the minimal contract for as.list() appears to be that it returns a VECSXP. To the user, we might say that is.list() will always return TRUE. I'm not sure we can expect consistency across methods beyond that, nor is it feasible at this point to match the semantics of the methods package. It deals in "class space" while as.list() deals in "typeof() space...
2014 Jun 24
2
using C code to create data frame but always return as list
...onst char* dfname="DataFrameName0tmp";  jl_set_global(jl_main_module, jl_symbol(dfname), (jl_value_t*)Var);  //Get Frame cols   sprintf(evalcmd,"size(%s,2)",dfname);  jl_value_t* cols=jl_eval_string(evalcmd);  int collen=jl_unbox_long(cols);  jl_value_t* eachcolvector;  //Create VECSXP  //Create SEXP for Each Column and assign  PROTECT(ans=allocVector(VECSXP,collen));  for (i=0;i<collen;i++)  {   sprintf(evalcmd,"%s[%d]",dfname,i+1);   eachcolvector=jl_eval_string(evalcmd);   SET_VECTOR_ELT(ans,i,Julia_R_MD_NA(eachcolvector));  }  //set names attribute  sprintf(eval...
2009 Sep 20
1
Return a list from a .Call but segfaults
...(where j was defined as vector(mode='list') ) The code below looks alright, but it appears to crash when getting copied. Now one could blame message2rexp (in kk_), but once in R, the result of .Call is assigned to ll, everything should be protected. In fact, if in kk_ i simply return a VECSXP with 2 elements, no errors, so one could conclude that message2rexp is to blame. Yet, when i replace the code with R code, that is using readBin and only calling calling C(to call message2rexp) to deserialize a raw vector, I get no such error. There is something I'm missing , could some...
2018 Feb 01
0
as.list method for by Objects
>>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>> on Tue, 30 Jan 2018 15:57:42 -0800 writes: > I just meant that the minimal contract for as.list() appears to be that it > returns a VECSXP. To the user, we might say that is.list() will always > return TRUE. Indeed. I also agree with Herv'e that the user level documentation should rather mention is.list(.) |--> TRUE than VECSXP, and interestingly for the experts among us, the is.list() primitive gives not only TR...
2014 Jun 26
1
using 2D array of SEXP for creating dataframe
...e the following code SEXP dfm ,head,df , dfint , dfStr,lsnm; *SEXP valueVector[2];* char *ab[3] = {"aa","vv","gy"}; int sn[3] ={99,89,12}; char *listnames[2] = {"int","string"}; int i,j; //============================= PROTECT(df = allocVector(VECSXP,2)); *PROTECT(valueVector[0] = allocVector(REALSXP,3));* *PROTECT(valueVector[1] = allocVector(VECSXP,3));* PROTECT(lsnm = allocVector(STRSXP,2)); SET_STRING_ELT(lsnm,0,mkChar("int")); SET_STRING_ELT(lsnm,1,mkChar("string")); SEXP rawvec,headr; unsigned char str[24]="ab...
2011 Jan 11
1
as.environment.list provides inconsistent results under torture
Hello, Using R-devel (rev 53950), I get inconsistent results with as.environment( VECSXP ) when gctorture is on. Consider: a <- list( aa = rnorm, bb = runif ) gctorture(TRUE) as.environment( a ) The last line sometimes produces the correct environment, but sometimes I get errors. Here are the three situations: # good > as.environment( a ) <environment: 0x100b1c978> #...
2013 Apr 01
2
Timing of SET_VECTOR_ELT
...ot;xyz" for the pointer to its contents.) PROTECT(means2 = allocVector(REALSXP, nvar)); means = REAL(means2); PROTECT(u2 = allocVector(REALSXP, nvar)); u = REAL(u2); PROTECT(loglik2 = allocVector(REALSXP, 2)); loglik = REAL(loglik2); PROTECT(rlist = mknamed(VECSXP, outnames)); Can I assign the individual elements into rlist using SET_VECTOR_ELT at this point, or do I need to wait until the end of the program, after I've filled in means[i], u[i], etc.? I likely depends on whether I'm assigning a pointer or a copy. Terry T.