similar to: .Call: is new attribute of protected object auto-protected

Displaying 20 results from an estimated 3000 matches similar to: ".Call: is new attribute of protected object auto-protected"

2004 Apr 26
1
Segfault: .Call and classes with logical slots
Hi, the following example aiming at a class containing a logical slot segfaults under R-1.9.0 when `gctorture(on = TRUE)' is used: Code code (dummy.c): #include <Rdefines.h> SEXP foo() { SEXP ans; PROTECT(ans = NEW_OBJECT(MAKE_CLASS("test"))); SET_SLOT(ans, install("lgl"), allocVector(LGLSXP, 1)); LOGICAL(GET_SLOT(ans,
2012 Sep 15
1
Question about copying arguments in C.
Hi List, I'd imagine this is a question that has been answered before, but I can't seem to track it down, sorry for the duplication if it has. I am writing an interface for a C library and want to return an S4 class from the 'constructing' method. One of the slots of the argument to be returned will be filled with one of the arguments passed to the function. My question is about
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
2008 Mar 15
1
Experimental R_has_slot() utility
Dear list, The utility "R_has_slot" mentioned in the file NEWS ("Experimental R_has_slot() utility supplementing R_do_slot()") appears to be missing from a fresh checkout of the development branch. $ svn up At revision 44759. $ grep -i has_slot `find include -name '*.h'` $ grep -i _slot `find include -name '*.h'` include/Rdefines.h:#define GET_SLOT(x, what)
2010 Feb 18
3
R CMD check: OK in LINUX. Crashes in Windows!
Hi, I have followed the recommended steps for creating a package (rctest). As of now, my goal is simply to understand how various pieces fit together. The package includes: (1) C code with source in sub-directories, compiled to create a static library. (a) There is a single C-struct (dns) a simple 'matrix': {int m; int n; double *d;} (b) C code to create random matrix of a certain size.
2003 Sep 05
1
Problem with S4 slots in C code (PR#4073)
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C3738F.63DE3390 Content-Type: text/plain; charset="iso-8859-1" #I want to be able to create a new S4 class and read data into it using C code # Here is a very simple S4 object inheriting from "array", but with 5
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
2007 Jan 23
2
is it necessary to always register C routines with R_registerRoutines?
I am writing bindings to the neural network simulator SNNS. At present I have used only .C interface, now I'm studying .Call interface. I have adapted the example from page 77 of r-exts.pdf, however, it crashes R. I use MingW as recommended by Duncan Murdoch. Please, tell me what I am missing. The code is below. Thank you. SEXP snns_getVersion(void) {SEXP version; char *v;
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
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
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
2008 Jan 29
2
Problem with new("externalptr")
Hi, It seems that new("externalptr") is always returning the same instance, and not a new one as one would expect from a call to new(). Of course this is hard to observe: > new("externalptr") <pointer: (nil)> > new("externalptr") <pointer: (nil)> since not a lot of details are displayed. For example, it's easy to see that 2
2003 Dec 10
0
C++: SET_LENGTH() Over Many Iterations?
In a C++ extension to R (v 1.8.1), I've been experimenting with a generic "push back" function to tack one value at a time onto the end of an R vector created within the extension. After calling this function a certain number of times Rgui.exe (I'm writing in Windows using Visual Studio .NET 2003) will fail with an Access Violation, which doesn't happen when I pre-allocate
2003 Oct 04
3
More questions about R extension programming
On Fri, 2003-10-03 at 17:01, Rajarshi Guha wrote: > Hi, > I'm using a package that has a number of formats. I have C code to > parse these formats the results of which are generally integer arrays. > > I would like to utilize these modules in R rather than writing R code to > read in these files (and also to learn about R extensions). Thanks for the pointers to the above
2005 Aug 17
4
accesing slots of S4 class in C code
I am trying to use a custom S4 object in my C code and I cannot get the access to its slots working. The following is a toy example, but even this crashes. In R I have: setClass("pd", representation(data="numeric")) x <- new("pd", data=1:5) test <- function(pd.obj) { res <- .C("TestFun", pd.obj) res} test(x) (Of couse
2005 Jul 26
1
Error registering finalizer
What exactly is a reference object? I'm getting this error message attempting to register a finalizer: can only weakly reference/finalize reference objects I don't see any problem with the code... Here's what appears to be the relevant portions. setClass("PDNNObject", representation(handle = "externalptr", id =
2005 Nov 18
3
Method for $
Dear R experts, I have defined a class "myclass" and would like the slots to be extractable not only by "@" but also by "$". I now try to write a method for "$" that simply executes the request object at slotname, whenever someone calls object$slotname for any object of class "myclass". I don't manage to find out how I can provide this
2005 Sep 13
3
NUMERIC_POINTER question
Dear R-developers, Using .Call I pass a S4 class with e.g. the following class definition: setClass("mmatrix",representation( data="matrix") ) On the "C side" i do mat = GET_SLOT(vs,install("data")); and then: printf("%f\n",NUMERIC_POINTER(mat)[1]); The above print statement produces the correct output if xx<- new("mmatrix")
2009 Sep 16
2
I want to get a reference to this time series object
I'm trying to get a reference to this object in C SWX.RET[1:6,c("SBI,"SPI","SII")] While i am able to access and use a plain SWX.RET object, I'm getting confused on how to create an object with the array subscripts like above. Here is what I tried to do. It doesn't work because "[" is obviously not an operation or function on SWX.RET. So how do I
2005 Mar 22
2
can R_do_slot_assign change slot type
Hi, It seems that R_do_slot_assign can change the type of an S4 class slot. For example I have a class setClass("ostream", representation(id = "integer", keepOpen = "logical")) and inside a C-function I was able to assign a RAW vector to the id slot. Is this intentional? I remember reading somewhere that the slot type is guaranteed by R. Maybe this doesn't