similar to: Calling primitive functions from C code

Displaying 20 results from an estimated 5000 matches similar to: "Calling primitive functions from C code"

2011 Mar 18
1
[Patch suggestion] Adding 3rd arg to tempfile() to set extension
The other day I was working on an example which used tempfile() to create file for use by the graphics device. And while I love tempfile()---as it is portable and clever and the files get cleaned by R and all that---I noticed one missing feature I would like to see: beside a starting name pattern, and an optional directory, an 'file extension' argument would be nice to have. As e.g. in
2005 Aug 22
2
RFC: "loop connections"
I've just implemented a generalization of R's text connections, to also support reading/writing raw binary data. There is very little new code to speak of. For input connections, I wrote code to populate the old text connection buffer from a raw vector, and provided a new raw_read() method. For output connections, I wrote a raw_write() to append to a raw vector. On input, the mode
2003 Oct 22
1
Windows RConsole Focus
Hi, I was looking for a Windows-specific R function to focus the console window and couldn't find one. The motivation is that after loading the tcltk package, the "main" Tk window "." is presumably focused but then immediately withdrawn (hidden) so the RConsole loses its focus and you have to click on it to continue typing. Would there be any interest in including a
2018 Dec 04
3
patch to support custom HTTP headers in download.file() and url()
The patch below adds support for custom HTTP headers in download.file() and url(). My main motivation for this is performing basic http authentication. Some web sites do not support embedding the credentials into the URI itself, they only work if the username and password are sent in the HTTP headers. In fact specifying the username and password in the URI has been
2010 May 24
1
Functioning and source code location of .Primitive()
Hi all. I began examining the R source code in the last few days, for a better understanding of its structure. I read the manuals and digged deeply (maybe not enough?) into the source code, but I couldn't totally understand how .Primitive() works. Its effects, if I understand well, are quite clear to me (calling the C compiled counterpart of a "primitive" function), but where is its
2005 Sep 18
0
Updated rawConnection() patch
Here's an update of my rawConnection() implementation. In addition to providing a raw version of textConnection(), this fixes two existing issues with textConnection(): one is that the current textConnection() implementation carries around unprotected SEXP pointers, the other is a performance problem due to prolific copying of the output buffer as output is accumulated line by line. This new
2011 Aug 14
0
Improved version of Rprofmem
The Rprofmem facility is currently enabled only if the configuration option --enable-memory-profiling is used. However, the overhead of having it enabled is negligible when profiling is not actually being done, and can easily be made even smaller. So I think it ought to be enabled all the time. I've attached a patch doing this, which also makes a number of other improvements to Rprofmem,
2003 Jul 07
0
feature enhancement request & patch: dev.control(displaylist='en (PR#3424)
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_01C344B0.28BC0750 Content-Type: text/plain; charset="windows-1252" Summary: Currently R provides > dev.control(displaylist='inhbit') to turn *off* the recording of graphics operations in a device, but there is no
2004 Jul 02
2
hclust
im using plclust and want the labels to be different colors. i took a look at getS3method("plot","hclust") and saw a call to .Internal. i looked at the help on .Internal and dont know where to go next. any help appreciated! thanks, rafael
2009 Nov 03
1
memory misuse in subscript code when rep() is called in odd way
The following odd call to rep() gives somewhat random results: > rep(1:4, 1:8, each=2) [1] 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 [26] 4 4 4 4 4 4 4 4 4 4 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA > rep(1:4, 1:8, each=2) Error: only 0's may be mixed with negative
2019 Feb 27
2
Intermittent crashes with inset `[<-` command
Valgrind (without gctorture) reports memory misuse: % R --debugger=valgrind --debugger-args="--leak-check=full --num-callers=18" ... > x <- 1:200000 > y <- rep(letters[1:5], length(x) / 5L) > for (i in 1:1000) { + # x[y == 'a'] <- x[y == 'b'] + x <- `[<-`(x, y == 'a', x[y == 'b']) + cat(i, '') + } 1 2 3 4 5 6 7 8 9 10
2010 Aug 16
2
Random Number Generators and Sample
I am trying to get documentation about the random number generator used in "sample". The help for sample does not mention it. Can anyone point me in the right direction. Thanks [[alternative HTML version deleted]]
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
2000 Jan 17
1
lwd patches for "contour"
I found it useful to have contour be able to do line widths ... hope that the guts haven't changed an enormous amount in the current development version ... the patches are relatively trivial, mostly going by analogy with lty and col (although in my ignorance it took me a while to figure out what UNPROTECT(2) was and why it should be changed to UNPROTECT(3) ... hope this is useful. Ben
2009 Mar 17
1
question on "row.names" attribute of dataframe when called from a compiled package
Why does the following show a class attribute of "character" when using the interpreter: x <- data.frame(hat=1:10) class(rownames(x)) ## returns [1] "character" but when called from c/cpp, the rownames attribute has no class attribute, and is in fact a vector of INTSXP? > .Call("print_class_of_rownames", x, package = "test") length(x): 10
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++) {
2000 Jan 29
1
HDF5 as a module
--=-=-= Included below are: 1) Diffs to to remove HDF5 from R 2) Diffs to pass thru --with-* options to a module's configure script during "R INSTALL". (To reiterate a plea for this capability...) This applies only to Unix, the Windows (mingw32 in my case) build approach of passing in make variables like *-CFLAGS and *-LDFLAGS works fine. The only hitch
1999 Jan 27
0
load() patch
Summary: patch to add environment parameter to load() to allow -------- specification of destination environment. --> Patch against R 0.63.2 appended at end of this message. <-- Story: ------ I've been running some rather long MCMC chains, which occasionally crash, either due to an "Invalid tag in name extraction" error, or due to the machine going down. (I'm playing
2013 Sep 30
1
how to interpose my own "[" function?
I want to create my own "[" function (for use on vectors, matrices, arrays, etc.), which calls the stock R "[", does some additional work, and then finally returns the modified result. But, how do I properly call the stock R "[" function? It takes a varying number of positional arguments, and its R-level closure is just: .Primitive("[") It's
2019 Sep 23
2
What is the best way to loop over an ALTREP vector?
Sorry for post a lot of things, for the first part of code, I copied my C++ iter macro by mistake(and you can see an explicit type casting). Here is the macro definition from R_exts/Itermacros.h #define ITERATE_BY_REGION_PARTIAL(sx, px, idx, nb, etype, vtype, \ strt, nfull, expr) do { \ * const** etype *px = DATAPTR_OR_NULL(sx); *