similar to: how to pass 'raw' values with cfunction()?

Displaying 20 results from an estimated 6000 matches similar to: "how to pass 'raw' values with cfunction()?"

2013 Feb 01
1
Problem using raw vectors with inline cfunction
Hello, >From what I understood from the documentation I found, when using the inline cfunction with convention=".C", R raw vectors should be given as unsigned char* to the C function. But consider the following script: library(inline) testRaw <- cfunction(signature(raw='raw', len='integer') , body=' int l = *len; int i = 0;
2019 Sep 15
2
REprintf could be caught by tryCatch(message)
Dear R-devel community, There appears to be an inconsistency in R C API about the exceptions that can be raised from C code. Mapping of R C funs to corresponding R functions is as follows. error -> stop warning -> warning REprintf -> message Rprintf -> cat Rprint/cat is of course not an exception, I listed it just for completeness. The inconsistency I would like to report is
2019 Sep 15
2
[External] REprintf could be caught by tryCatch(message)
Thank you Luke for prompt reply. Is it possible then to request a new function to R C API "message" that would equivalent to R "message" function? Similarly as we now have C "warning" and C "error" functions. Best, Jan On Sun, Sep 15, 2019 at 5:25 PM Tierney, Luke <luke-tierney at uiowa.edu> wrote: > > On Sun, 15 Sep 2019, Jan Gorecki wrote:
2010 Mar 18
2
recommendations on use of -> operator
I have never used -> but I noticed at http://github.com/jiho/r-utils/blob/master/beamer_colors.R that some people do. In fact, the above-named code has a sort of elegance about it (except for the use of "=" for assignment...). To my eye, -> calls to mind a type of assignment that is meant to stand out. For example, perhaps it would make sense to use -> to assign
2014 Jan 28
2
how to unbreak a circular package dependence (S4 class data)
I have an issue with a circular package dependence that prevents building/checking, and I seek advice on breaking the circle so the packages can pass the build-check tests that are required for CRAN submission. The package pair I'm working with is slow to build, but my tests suggest the issue may be general, and so I will explain it in general terms. Suppose there are two packages: 1. Foo,
2005 May 06
1
R on Macintosh OSX Tiger
Hi. I'm not having any luck installing the binary for the new Macintosh OS called "Tiger". I get error messages as below. Can anyone offer me some advice? (PS: I checked the bug list first but a search on "Tiger" turned up nothing so I hope it's OK to post here.) Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared
2009 Jul 20
3
S_alloc or Calloc for return value
I am trying to write a C function to create a vector of integers that can be used by the R calling function. I do not know the size of the vector in the R calling function. (Well, actually, I have an upper limit on the size, but that is so large that R cannot allocate it. What I'm doing in the function is to do a sieving procedure, and the result will be small enough to fit into my
2008 Dec 19
1
can a function alter the "..." argument and passed the result to another function?
Is there a way a function ('parent', say) can manipulate the ... argument, and then pass the manipulated value into another function ('child', say) that it calls? What I'm trying to do is to use some plotting defaults within 'parent' that are not part of parent's argument list, but to let the use over- ride these defaults if they choose. A sketch is below.
2007 Oct 22
1
question on axis box with asp=1
I've been using (and loving) R for quite a while now, but I have to admit that something simple is still stumping me. The question is how I can control the box within which a plot is drawn, in cases where I'm controlling the aspect ratio with the "asp" argument. The problem comes up in pdf() and png() output formats, but also with interactive windows, and so I'll
2010 Jun 18
3
C interface
Greetings, I am trying to call simple C-code from R. I am on Windows XP with RTools installed. The C-function is #include <R.h> #include <Rinternals.h> #include <Rmath.h> #include <Rdefines.h> // prevent name mangling extern "C" { SEXP __cdecl test(SEXP s){ SEXP result; PROTECT(result = NEW_NUMERIC(1)); double* ptr=NUMERIC_POINTER(result); double t =
2014 Oct 31
3
ScalarLogical and setAttrib
Is it expected that attributes set on a LGLSXP created by ScalarLogical will apply to all future objects created by ScalarLogical as well? For example: the 'test1' function below returns FALSE and 'test2' returns FALSE with an attribute: library(inline) test1 <- cfunction(body = 'return ScalarLogical(0);') test2 <- cfunction(body = ' SEXP success =
2000 Jun 03
4
How to do linear regression with errors in x and y?
QUESTION: how should I do a linear regression in which there are errors in x as well as y? SUPPLEMENT: I've seen folks approach this problem by computing eigenvectors of the covariance matrix, and that makes sense to me. But I'm wondering if this has a "pedigree" (i.e. if it makes sense to folks on this list, and if it's something that has been published, so I can refer to
2005 Aug 20
1
Implementing a single-precision class with raw
A package that I develop (xcms) sometimes needs to read and process vectors several hundreds of megabytes in size. (They only represent parts of a large data sets which can approach nearly 100GB.) Unfortunately, R sometimes hits the 2GB memory limit of Win32. To help cut the memory footprint in half, I'm implementing a "float" class as a subclass of "raw". Because
2010 Jun 18
4
C Interface
Greetings, I am trying to call simple C-code from R. I am on Windows XP with RTools installed. The C-function is #include <R.h> #include <Rinternals.h> #include <Rmath.h> #include <Rdefines.h> // prevent name mangling extern "C" { SEXP __cdecl test(SEXP s){ SEXP result; PROTECT(result = NEW_NUMERIC(1)); double* ptr=NUMERIC_POINTER(result); double t =
2009 Aug 14
1
Package-level access to Rp->R_Quiet ?
I would like to simulate the effect of the command-line option --quiet from user-level scripts and startup code. From src/main/CommandLineArgs.c I learn that Rp->R_Quiet is set, and I see how that is used in main/main.c. I would use this from code in Rprofile.site. In other words, I want to be silent when --quiet is used (as e.g. by littler or Rscript) but not by R itself in normal
2020 Jun 30
3
Build a R call at C level
On 6/30/20 1:06 PM, Jan Gorecki wrote: > It is quite known that R documentation on R C api could be improved... Please see "5.11 Evaluating R expressions from C" from "Writing R Extensions" Best Tomas > Still R-package-devel mailing list should be preferred for this kind > of questions. > Not sure if that is the best way, but works. > > call_to_sum <-
2000 Feb 24
1
queueing problems
howdy R friends, I'm new but I used to play with S+ a long time ago. Can someone please help me with how to approach this? I have some response time data I want to 'correlate' with other data. I believe queueing is involved so I need to prove somehow (F test?) that response ~ exponential(...) How do I go about this? I cant find exponential in 'nlm' or other functions.
2020 Jun 30
2
Build a R call at C level
Hi All, I was reading the R extension manual section 5.11 ( Evaluating R expression from C) and I tried to build a simple call to the sum function. Please see below. call_to_sum <- inline::cfunction( language = "C", sig = c(x = "SEXP"), body = " SEXP e = PROTECT(lang2(install(\"sum\"), x)); SEXP ans = PROTECT(eval(e, R_GlobalEnv)); UNPROTECT(2); return
2006 May 28
1
cartograms in R?
Q: Has anyone implemented cartograms [**] in R? A search on the R site turned up https://stat.ethz.ch/pipermail/r-sig-geo/2005-December/000698.html which led to http://www.okada.jp.org/RWiki/index.php?cmd=read&page=Rmap%A4%F2%BB% C8%A4%C3%A4%BF%C3%CF%BF%DE%C9%BD%BC%A8&word=Rmap#content_1_35 which has (one form of) a cartogram as a PNG, but which doesn't seem to have code. (The
2010 Apr 13
3
Inline Package: void vs return type functions
Dear all, After having a look at the "inline" package and also going through the "Rcpp" package which is tighty related to it, it came to me this question: 1) my C/ C++ code has a return type (let say a double[][] or a user define class) 2) I am working with an extensive library built by someone else and I don't have the time/knowledge to change it by means of working