similar to: using 2D array of SEXP for creating dataframe

Displaying 20 results from an estimated 130 matches similar to: "using 2D array of SEXP for creating dataframe"

2014 Mar 06
1
Create dataframe in C from table and return to R
Hi , I am trying to create a dataframe in C and sebd it back to R. Can anyone point me to the part of the source code where it is doing , let me explain the problem I am having . -------------------------------------------------------------------- My simple implementation is like this SEXP formDF() { SEXP dfm ,df , dfint , dfStr,lsnm; char *ab[3] =
2005 Mar 23
0
Looking for function for Double to raw to double conversions
Hello, I am trying to implement function for reading/writing some XML file format. One feature of that XML format is that a lot of binary data is stored in Base64 format, and since R's XML package does not seem to support it, I just wrote my own converter from "raw" format to Base64, and back. However one place I have problems with is conversion from vector of doubles to vector of
2006 Sep 28
1
eval(SEXP fn,SEXP rho) in C++ code
Hi r-devel, I am working on a R extension. I am writing the function in C++, and in my function it is required a R function object from the user. This R function object will be evaluated thousand of times in my C++ code. I generated the shared library and I loaded it on R. I did several experiments in order to compare the speed of my compiled code vs the speed of the equivalent interpreted code.
2011 Sep 13
1
Getting Rcpp SEXP data in C++
Friends I am looking at Rcpp and I am a bit stuck on a simple matter. (I am calling R from c++, if there is a better way...) Given this simple example using the TTR package and the SMA function which returns a simple moving average.... Rcpp::NumericVector rv; for(int i = 0; i < 100; i++){ rv.push_back(rand()); } Rcpp::Environment TTR("package:TTR");
2006 Nov 07
1
Getting the name of a SEXP type in package code?
Hi, Is there an alternative to type2char that is available for use in package code? It would be useful for producing more informative error messages. + seth
2007 Mar 16
1
Invalidating inaccessible SEXP?
Is there a (C or R) function to invalidate the relevant parts of SEXP / data that are inaccessible? My problem is in tracking down protection and other memory mismanagement bugs, where I have to rely on luck to invalidate or overwrite data to trigger a detectable error. This makes it hard to track down a bug (it sometimes doesn't occur), or to know that a patch fixes the problem. Thanks,
2008 Mar 05
1
SEXP size management.
Hi, Trying to decrease the size of a SEXP variable without reassigning values individually in a loop. So far, I've tried using Realloc, as the follow source demonstrates: SEXP dothis() { SEXP Rblah; PROTECT(Rblah = NEW_INTEGER(6)); int* blah = INTEGER(Rblah); blah[0] = 1; blah[1] = 2; blah[2] = 3; Realloc(Rblah, 3, INTEGER); UNPROTECT(1); return(Rblah); } According to the
2010 Feb 20
1
how to create a SEXP which could be accessed in embedded R
Hi all, I am not familiar with writing R extensions. In a C program, I want to create a SEXP and access it in embedded R. How to let the embedded engine know there's a new vector? For example, after creating a SEXP, parsing 'ls()' in embedded R and then evaluating, STRSXP returned will contain the name of the SEXP. Any help would be appreciated. Regards, Spiral [[alternative HTML
2020 Sep 08
1
some questions about R internal SEXP types
On Tue, Sep 8, 2020 at 4:12 AM Tomas Kalibera <tomas.kalibera at gmail.com> wrote: > > > The general principle is that R packages are only allowed to use what is > documented in the R help (? command) and in Writing R Extensions. The > former covers what is allowed from R code in extensions, the latter > mostly what is allowed from C code in extensions (with some references
2003 Aug 14
0
Simple C-R interface, SEXP and other declarations
I am trying to integrate OpenOffice Calc (OO) with R. One of the steps I am taking is to create a very simple command line C program with the R shared lib embedded in it. It would simply pass an R/S expression to R, print the result, and catch errors. I know this is "overkill," but it is a step toward something larger. Has anyone done this before? If so, I would love to check out
2010 Sep 28
1
How to convert SEXP to double
Hello All, A simple question. I get some return from the R in my C++ program (via Rcpp package). The result come, as SEXP and it should be a simple numeric variable. How to convert it to double? The code, what i use: stringstream ss; ss << "p <- predict(fit_ar11, n.ahead = 2, doplot=FALSE);" << "p$pred[1]"; SEXP ans; int iRet =
2008 Feb 19
1
level of mutability for the type of a SEXP
Dear list, I am writing C code to interface with R, and I would like to know the level of mutability for the type of a SEXP. I see that there is a macro/function TYPEOF(), and that it can be used as an l-value, as well as a macro/function SET_TYPEOF(). My question is "should the type be considered immutable, or it can it change after the SEXP has been created and used for a while ?".
2003 Dec 17
1
Accessing row and col names of SEXP objects
Can someone lend me a hand with extracting the dimnames from a SEXP? I've looked through R-exts, but I couldn't find an example. Here is the code I'm using to grab the jth column name and print it, but the colnames I'm getting are garbage. None of the following are working. void printInfo(SEXP ts) { int j; for (j=0; j<col; j++) {
2013 Feb 20
1
GC encountered a node (…) with an unknown SEXP type
Dear All, I'm trying to track down a very erratic bug in some fortran; I have an example that quite consistently segfaults on windoz, and more sporadically on mac, all in the course of doing some bootstrap calculations, varying the set.seed call, but I'm now trying to see what is going on on our redhat system: R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
2013 Mar 01
1
.Call interface: Use R SEXP as C mutable *char
Dear R Developers, DISCLAIMER: I am new to package development in R and new to this list. I am trying to do something along the lines of: SEXP test_fun (SEXP filename) { const char *inputfile = translateChar(STRING_ELT(filename, 0)); int abc = some_function(inputfile); ... } The code compiles fine, but I get a warning: "passing argument of 'some_function' discards qualifiers
2020 Sep 08
0
some questions about R internal SEXP types
On 9/8/20 1:13 PM, Dan Kortschak wrote: > On Tue, 2020-09-08 at 12:08 +0200, Tomas Kalibera wrote: >> I am not sure if I understand correctly, but if you were accessing >> directly the memory of SEXPs from Go implementation instead of >> calling >> through exported access functions documented in WRE, that would be a >> really bad idea. Of course fine for research
2006 Jul 11
2
Converting SEXP to primitive C types
I'm new to R development, so this may be a trivial question. In C, How do you convert a SEXP value returned by an R function to a primitive C type (int, double, char, array, etc.)? I've tried using the INTEGER(x), VECTOR_ELT(x,i), and similar functions found in /src/ include/Rinternals.h, but doing so results in incorrect results or a seg-fault. For example, I modified
2004 Sep 20
1
problem typcasting return of R_ExternalPtrAddr(SEXP s)
In the odesolve routine lsoda(), I allow the function (named func) that calculates the system of differential equations to be defined in a dll that has been dynamically loaded from the file named in dllname. I use getNativeSymbolInfo(func, dllname)$address to get the address of the function and pass it to a C function called via the .Call interface. Inside that C function, I use
2020 Sep 07
0
some questions about R internal SEXP types
Thanks, Gabriel. On Mon, 2020-09-07 at 14:38 -0700, Gabriel Becker wrote: > I cannot speak to initial intent, perhaps others can. I can say that > there is at least one place where the difference between R_NilValue > and NULL is very important as of right now. The current design of the > ALTREP framework contract expects ALTREP methods that return a SEXP > to return C NULL when
2011 Mar 23
2
Standalone C++ application for processing R parser output(SEXP)
Hi All, I am trying to write a source-to-source compiler for R. I am trying to leverage the R parser code for the purpose. I am trying to transform the SEXP returned from the parser into an AST for our own Ruby embedded Domain specific language. I tried using R CMD SHBIN to compile a C function that parses arbitrary R expressions. But I think, the generated .so file can be used from within R and