similar to: SEXP size management.

Displaying 20 results from an estimated 300 matches similar to: "SEXP size management."

2003 Dec 12
3
C++: Appending Values onto an R-Vector.
Hi folks. I posted this question a few days ago, but maybe it got lost because of the code I included with it. I'm having a problem using the SET_LENGTH() macro in an R extension I'm writing in C++. In a function within the extension I use SET_LENGTH() to resize R vectors so as to allow the concatenation of single values onto the vectors -- it's a "push back" function to
2001 Sep 10
1
not safe to return vector pointer
Hello All, I recently upgraded from R-1.1.1 to R-1.2.2. I have an R function that uses .Call() to return a list from C code. The C code has the form: SEXP function(SEXP var) { SEXP rlist ; PROTECT(rlist = NEW_LIST(3)) ; VECTOR_PTR(rlist)[0] = NEW_INTEGER(1) ; VECTOR_PTR(rlist)[1] = NEW_STRING(1) ; ... UNPROTECT(1) ; return(rlist) ; } When I try to
2006 May 08
1
Calling C++ code fom R --How to export C++ "unsigned" integer to R?
Hello all, Is there a way to export C++ "unsigned" integer to R? (I am trying to parse files in "BPMAP" format, and some variables are of type unsigned int (first declared in C++) ). I know that to export signed integer to R, I can do the following in C++: int Some_INTEGER = 5; int *p_myInt; SEXP myInt; PROTECT(myInt=NEW_INTEGER(1)); myInt[0] = Some_INTEGER;
2012 May 29
1
(no subject)
Hey All, I'm developing a site on a VPS that comes stock with dovecot 1.2.17 and I'm trying to setup some functionality that is very specific to our business model. My question is this: How do I create (programatically) aliases for a forwarder? I have an address, email at domain.com that gets sent to a php script and I want users to be able to send to that script via any number of
2004 Feb 11
1
.Call setAttrib(ans,R_DimSymbol,dim); Crashes.
Hi! I want to return a matrix. The code does the R interfacing. This version does it fine. SEXP ans,dim; PROTECT(ans = NEW_NUMERIC(count*2)); memcpy(NUMERIC_POINTER(ans),result,count*sizeof(double)); memcpy(&(NUMERIC_POINTER(ans)[count]),occur,count*sizeof(double)); /** PROTECT(dim=NEW_INTEGER(2)); INTEGER_POINTER(dim)[0]=2; INTEGER_POINTER(dim)[1]=count;
2005 Aug 29
1
Question about SET_LENGTH
Hello all, thanks for all the help on the other issues. This one should be relatively straightforward. I have a vector of integers which I allocate to be the maximal size possible (meaning I'll never see more than cel.GetNumOutliers, but most likely I'll see less) therefore, I want to resize the vector, one solution would be to allocate a new vector then to copy into the new vector. That
2005 Apr 14
1
question about "R get vector from C"
Dear ALL-R helpers, I want to let R get vector from c ,for example :numeric array ,vector .I saw some exmple like this : /* useCall3.c */ /* Getting an integer vector from C using .Call */ #include <R.h> #include <Rdefines.h> SEXP setInt() { SEXP myint; int *p_myint; int len = 5; PROTECT(myint = NEW_INTEGER(len)); // Allocating
2006 Jun 03
1
Fw: Compiling chan_bluetooth
Just to close the thread. The problem was that I was using an old version of the code. If anyone has the same problem, you can download the code from here: http://www.thetechguide.com/howto/asterisk/bluetoothfiles.tar.gz Good luck, Danko ----- Original Message ----- From: "Danko Miocevic" <danko@santirso.com.ar> To: "Asterisk
2000 Apr 01
1
Bug ? mine or ? in R core
Dear R Gurus, I would very much appreciate some help with this code snippit from my RODBC package. R crashes or exhibits bizarre behaviour when repeatedly fetching large numbers of rows. Examples: > odbcFetchRows(0,max=50000)->xx > odbcFetchRows(0,max=50000)->xx > odbcFetchRows(0,max=50000)->xx > odbcFetchRows(0,max=50000)->xx > odbcFetchRows(0,max=50000)->xx 3rd
2009 Sep 25
1
Problem with dgamma function.
Hi, All, I am getting some funny results trying to use R's built in distribution functions. In R: > dgamma(4.775972,1.37697964405418, 0.106516604930466) [1] 0.05585295 > dgamma(4.775972,1.37697964405418, 0.106516604930466,TRUE) ### THIS IS JUST WRONG! [1] 0.01710129 > log(dgamma(4.775972,1.37697964405418, 0.106516604930466)) [1] -2.885033 > In C:
2006 May 08
4
Asterisk documentation..
Where can I get some asterisk books.. or tutorials..? I?ve been searching in google.. but I find just some tutorials explaining how to fast set up an asterisk server. I want to learn how to use it and how to make my own configurations. So, the thing is that I want to know what is the best book or tutorial that you know? recomendations? Thanks to everyone... Danko Miocevic
2006 Aug 21
1
return tree from .Call
Hello: I was hoping to get some advice about how to return a tree (basically a linked list -- with each node containing a parent, left, and right node pointers) from a C routine back into R. Each node itself contains several attributes (a double, a char *, an int, and a void * ) Initially I was thinking I could just return to R a SEXP containing a pointer to the Root Node, but then realized
2006 May 27
1
Compiling chan_bluetooth
Hello, I?m trying to use my phone with asterisk to get GSM connectivity but I can?t compile the code. I got the asterisk, chan_bluetooth, zaptel and libpri sources, the last two ones compiled perfectly. I have added this to the /usr/src/asterisk/channels/Makefile: include /usr/src/chan_bluetooth/Makefile and I?ve also added chan_bluetooth.so to the CHANNEL_LIBS var. When I do "make
2013 Jun 27
3
Read a text file into R with .Call()
Hi, I want to read a text file into R with .Call(). So I define some NEW_CHARACTER() to store the chracters read and use SET_STRING_ELT to fill the elements. e.g. PROTECT(qNames = NEW_CHARACTER(10000)); char *foo; // This foo holds the string I want. while(foo = readLine(FN)){ SET_STRING_ELT(qNames, i, mkChar(foo))); } In this way, I can get the desired character from qNames. The only problem
2007 Nov 16
4
Returning vectors of two different data types back to R environment (from C).
Hello, Quick question. I have written a C function - I would like to make it return two vectors to the R environment - one STRSXP vector, and one INTSXP vector. Is this possible/ easy to do using the API? I looked, but could not find the answer to this question in the "Writing R Extensions" guide. Thanks very much for your help! Charles [[alternative HTML version deleted]]
2003 Dec 09
1
R Interface handholding
Hello, I need a bit of handholding with R, specifically, with writing packages for it. I'm a systems programmer, and am, on the request of several users of our software, working on generating R interfaces. For starters, I've written the following R function (which compiles): SEXP myincr(SEXP Rinput) { // Returns input integer incremented by one int input; SEXP returner; PROTECT(Rinput =
2004 Jun 22
3
[Q] GET_DIM() crash on Windows only
I have the following contrived code in package format. On Solaris and Mac OS X, code runs just fine. On Windows, it crashes the R environment with the "Send Bug Report" dialog. I tried R 1.8.1 (Win2K) and R 1.9 (WinXP) binaries with the same result. PCs otherwise appear properly configured for creating R packages. Anything blatantly wrong? Suggestions? TIA Relevant files from package
2003 Jun 23
3
FW: S4 classes, creating in C
I am using C code to create an S4 object based on Douglas Bates's example in his lecture notes on <http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Tutorials/RExtensions/slide s.pdf> http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Tutorials/RExtensions/slides .pdf e.g. SEXP La_DGE_dc(SEXP A) { SEXP aa = PROTECT(duplicate(A)); SEXP adims, pivot, val; int
2017 Nov 02
2
Why am I getting FrameIndex:i64<0> when I have no i64's?
Here's the IR I'm trying to compile for my backend, a 16-bit CPU: ; ModuleID = 'foo.c' source_filename = "foo.c" target datalayout = "E-m:e-p16:16:16-i1:16:16-i8:16:16-i16:16:16-i32:16:16-i64:16:16-S16-n16" target triple = "tms9900" @global_var = common global i16 0, align 2 ; Function Attrs: noinline nounwind optnone define signext i16 @dothis(i16
2007 Jun 07
5
[LLVMdev] libc dependencies, code generation questions
Hello, I'm looking into creating an llvm backend for the Free Pascal Compiler (<http://www.freepascal.org>). After reading a bit through the documentation and looking at some code generated by llvm-gcc, I have a couple of questions: 1) is there a way to specify ranges in the switch statement? Pascal supports switch statements (called "case" statements there) which