Displaying 20 results from an estimated 1000 matches similar to: "missing IntegerFromString()"
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
2013 Apr 17
1
stack imbalance in max.col for non-real matrices
It's tough to reliably reproduce, but I often get stack imbalance warnings
when calling max.col() on non-real/double matrix. The code is conditionally
PROTECTing but not incrementing its nprot counter for the eventual
UNPROTECT. Pretty sure this would fix (but I haven't tested it):
Index: array.c
===================================================================
--- array.c (revision
2012 Nov 15
1
bug with mapply() on an S4 object
Hi,
Starting with ordinary vectors, so we know what to expect:
> mapply(function(x, y) {x * y}, 101:106, rep(1:3, 2))
[1] 101 204 309 104 210 318
> mapply(function(x, y) {x * y}, 101:106, 1:3)
[1] 101 204 309 104 210 318
Now with an S4 object:
setClass("A", representation(aa="integer"))
a <- new("A", aa=101:106)
> length(a)
2003 Sep 29
1
Rcmdr and Macintosh
Hi everyone!
I am planning to use R and Rcmdr in a basic stat course. I have no access to a computer lab, but I can expect all students to have a laptop. Of couse, I have no control over their OS and in my experience several of them will have Macs. I have Windows. My question is the following: can I expect them to be able to install R, Tcl/Tk and Rcmdr (i.e. does anybody has experinece with it?)
2003 Oct 01
1
Macintosh binaries; was: Rcmdr and Macintosh
I am a Windows user and trying to make life easier for my Mac-using students. After investigating the Mac situation more, it appears that the key to easy use is having precompiled binaries. However the packages I am interested in (Rcmdr and its required package, car) do not have one. I do not have easy access to a Mac, so I have a plea to Macintosh users: could someone please create them if it is
2020 Jun 17
2
subset data.frame at C level
Hi,
Hope you are well.
I was wondering if there is a function at C level that is equivalent to
mtcars$carb or .subset2(mtcars, "carb").
If I have the index of the column then the answer would be VECTOR_ELT(df,
asInteger(idx)) but I was wondering if there is a way to do it directly
from the name of the column without having to loop over columns names to
find the index?
Thank you
Best
2020 Jun 16
1
[External] numericDeriv alters result of eval in R 4.0.1
Dear all
As far as I could trace, looking at the function C function numeric_deriv,
this unwanted behavior comes from the inner most loop in, at the very end
of the function,
for(i = 0, start = 0; i < LENGTH(theta); i++) {
for(j = 0; j < LENGTH(VECTOR_ELT(pars, i)); j++, start += LENGTH(ans)) {
SEXP ans_del;
double origPar, xx, delta;
origPar = REAL(VECTOR_ELT(pars, i))[j];
2006 Jun 22
2
.Call and data frames
Hello,
I'm trying to fetch a data frame through the C API,
and have no problem doing this when all columns
are numbers, but when there is a column of
strings I have a problem. On the C-side the
function looks like:
SEXP myfunc(SEXP df),
and it is called with a dataframe from
the R side with:
.Call("myfunc", somedataframe)
On the C side (actually C++ side) I use code
like this:
2012 Dec 15
3
interfacing with .Call
Hi
My code is as following:
#include <R.h>
#include <Rinternals.h>
//* the Projector part *//
void Projector(double *L, int *dimL, double *G, int *dimG, double *W, int
*dimW, int *xymod, int *dimxy, double *modif, int *dimif, double *Lsum)
{ ...}
//* the interface part *//
#define getDim(A) INTEGER(coerceVector(getAttrib(A,R_DimSymbol), INTSXP))
SEXP Projector5(SEXP L, SEXP G,
2020 Jun 15
2
numericDeriv alters result of eval in R 4.0.1
Dear R developers,
I've run into a weird behavior of the numericDeriv function (from the stats
package) which I also posted on StackOverflow (question has same title as
this email, except for the version of R).
Running the code bellow we can see that the numericDeriv function gives an
error as the derivative of x^a wrt a is x^a * log(x) and log is not defined
for negative numbers. However,
2009 Jan 19
1
Floating point excepting when cbind()ing a matrix of grobs (or environments) with a 0-column matrix
library(grid)
e <- rectGrob()
# OR:
# e <- environment()
a <- matrix(list(e), ncol = 1, nrow = 2)
b <- matrix(ncol = 0, nrow = 2)
cbind(a, b)
cbind(a, b)
This reliably crashes R for me.
I realise this is a rather esoteric error condition, but it crops up
for me when creating matrices of grobs to be turned into a ggplot2
plot.
Hadley
--
http://had.co.nz/
2009 Nov 21
1
R strings, null-terminated or size delimited?
Hello.
I've been looking at vecsexps for my binding.
Concerning strings, I'm wondering: are they supposed to be
null-delimited? Are they delimited by the info in the SEXPHEADER macro
in Rinternals.h?
Basically, what are the macros or functions to access the values of the
vecsexps? I'm thinking of CHARSXPs and INTSXPs for the moment...
All the best,
--
Guillaume Yziquel
2008 Apr 05
2
Adding a Matrix Exponentiation Operator
Hi all
I recently started to write a matrix exponentiation operator for R (by
adding a new operator definition to names.c, and adding the following code
to arrays.c). It is not finished yet, but I would like to solicit some
comments, as there are a few areas of R's internals that I am still feeling
my way around.
Firstly:
1) Would there be interest in adding a new operator %^% that performs
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
2007 Jul 10
1
How to preserve data across function calls in a library package
Hi,
I am writing an R package with two functions in C++. So far
everything works.
Now, i would like to write a third function which would use a pointer
(it is a pointer to a class object) created by first function.
I tried placing this pointer outside of the function definitions
(i.e to make it global) but when called in the 3rd function i get
> *** caught bus error ***
address 0x0,
2007 Jul 10
1
How to preserve data across function calls in a library package
Hi,
I am writing an R package with two functions in C++. So far
everything works.
Now, i would like to write a third function which would use a pointer
(it is a pointer to a class object) created by first function.
I tried placing this pointer outside of the function definitions
(i.e to make it global) but when called in the 3rd function i get
> *** caught bus error ***
address 0x0,
2014 Mar 05
1
[PATCH] Code coverage support proof of concept
Hello,
I submit a patch for review that implements code coverage tracing in
the R interpreter.
It records the lines that are actually executed and their associated
frequency for which srcref information is available.
I perfectly understands that this patch will not make its way inside R
as it is, that they are many concerns of stability, compatibility,
maintenance and so on.
I would like to have
2008 Apr 10
1
Computing time when calling C functions - why does an extra function call induce such an overhead?
Dear list,
I am a little puzzled by computing time in connection with calling C functions. With the function mysolve1 given below I solve Ax=B, where the actual matrix operation takes place in mysolve2. Doing this 5000 times takes 3.51 secs. However, if I move the actual matrix inversion part into mysolve1 (by uncommenting the two commented lines and skip the call to mysolve2) then the
2020 Jan 09
6
Get memory address of an R data frame
Hello,
I would like for my C function to be able to manipulate some values stored in an R data frame.
To achieve this, a need the (real) memory address where the R data frame stores its data (hopefully in a contiguous way). Then, from R, I call the C function and passing this memory address as a parameter.
The question: how can we get the memory address of the R data frame?
Thank you!
L.
2015 Sep 20
2
Long vectors: Missing values and R_xlen_t?
Is there a missing value constant defined for R_xlen_t, cf. NA_INTEGER
(== R_NaInt == INT_MIN) for int(eger)? If not, is it correct to
assume that missing values should be taken care/tested for before
coercing from int or double?
Thank you,
Henrik