Displaying 20 results from an estimated 1000 matches similar to: "Accessing row and col names of SEXP objects"
1999 Nov 23
2
rbind problem (PR#338)
In the new version 0.90.0, rbind won't take a vector and a matrix from me,
but works OK if I coerce the vector to a matrix. The following was run on
a new session (i.e., no prior work), and has been duplicated on 2
machines: an SGI running Irix 6.5, and an Intel box running Red Hat Linux
6.0.
Either case works fine in version 0.65.1.
> t3 <- c(.5, .5)
> t4 <-
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
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:
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
2006 Jul 18
2
send a list from R to C
Hello at all !
What is the correct form to give a list form R (e.g. list(c(-1,1),
"TestFile") ) to C. I have no problems, if I don't use character and I have
also no problems to give a character vector form R to C. But, if I combine
real and strings in a list then I don't know the correct syntax.
I try it with following (an example):
SEXP writeFile(SEXP headerR){
Image
2000 Aug 09
2
GenGC changes
As most R developers maybe are already aware of, R version 1.2.0
introduced a new `generational' garbage collector which means that
strings and vectors (and language objects) are handled differently from
the numerical atomic types.
>From ``Writing R Extensions'':
Earlier code was written in a style like.
VECTOR(dimnames)[0] = getAttrib(x, R_NamesSymbol);
2005 Jan 24
4
converting R objects to C types in .Call
Dear People,
I'm trying to write an R wrapper for a C++ library, using .Call. I've
never used .Call before. I'm currently having some difficulties converting
a R character string to a C one.
Here is a little test program.
#include <R.h>
#include <Rinternals.h>
#include <stdio.h>
SEXP testfn(SEXP chstr)
{
char * charptr = CHAR(chstr);
printf("%s",
2020 Jun 07
5
use of the tcltk package crashes R 4.0.1 for Windows
So this wasn't tested for a month?
Anyways, Free() is just free() with a check that we're not freeing a null pointer, followed by setting the pointer to NULL. At that point of tcltk.c, we have
for (objc = i = 0; i < length(avec); i++){
const char *s;
char *tmp;
if (!isNull(nm) && strlen(s = translateChar(STRING_ELT(nm, i)))){
// tmp =
2007 Jun 04
2
missing IntegerFromString()
I have created a DLL not so long ago using C code. My code used the
IntegerFromString() function that used to be exported in the
Rinternals.h header file (and thus easily accessible). Recently I
upgraded to R 2.5.0 and my DLL stopped working. I see that the
IntegerFromString() function is not exported in any of the header files
in the RHOME\include directory. Is it possible for me to use it
2020 Jun 07
3
[External] Re: use of the tcltk package crashes R 4.0.1 for Windows
On Sun, Jun 7, 2020 at 5:53 PM <luke-tierney at uiowa.edu> wrote:
>
> On Sun, 7 Jun 2020, peter dalgaard wrote:
>
> > So this wasn't tested for a month?
> >
> > Anyways, Free() is just free() with a check that we're not freeing a null pointer, followed by setting the pointer to NULL. At that point of tcltk.c, we have
> >
> > for (objc = i = 0;
2002 Oct 27
3
RODBC patchlet
[ Disclaimer: Yes, I do know that RODBC is in a state of minor limbo as far
as maintenance is concerned. But it is also useful, and used, which is why I
hope that someone might apply the small change outlined below. ]
The current version in CRAN's devel directories fails to build under R 1.6.1
(beta from Oct 27):
chibud:/home/edd/RODBC# R CMD INSTALL .
* Installing *source* package
2002 Mar 02
1
accessing factor levels from C
Hi,
I am trying to get information about factors from a C-program. As I see,
the factors are basically integers with attribute ,,levels''. But
unfortunately I am not been able to read the levels information. I am
using:
SEXP variable, levels;
...
variable = VECTOR_ELT( data_frame, j);
switch( TYPEOF( variable)) {
case INTSXP:
if( isFactor( VECTOR_ELT( data_frame,
2009 Jan 05
1
can't get names of R_env
Hi,
I'm quite knew in R, so I might not have the R specific jargon.
But here is my problem,
I'm trying to access and use variabels given by a function environment,
more specifically the rho in do_optim in src/main/optim.c
According to the documentation
http://cran.r-project.org/doc/manuals/R-ints.html#The-_0027data_0027
the envsxp is defined as a tagged pairlist.
"ENVSXP: Pointers
2010 Nov 15
1
SEXP and slots
Hello,
Since people have whisperred about Rcpp, I'd like to play too.
> On 11/15/2010 07:45 AM, Patrick Leyshock wrote:
>> Very helpful, thank you.
>>
>> A couple other questions, please:
>>
>> 1. I've got a function written in C, named "my_c_function". In my R
>> code I call this function, passing to it an INTSXP and a STRSXP,
>>
2010 Aug 26
2
Speeding up transpose
I've looked at how to speed up the transpose function in R
(ie, t(X)).
The existing code does the work with loops like the following:
for (i = 0; i < len; i++)
REAL(r)[i] = REAL(a)[(i / ncol) + (i % ncol) * nrow];
It seems a bit optimistic to expect a compiler to produce good code
from this. I've re-written these loops as follows:
for (i = 0, j = 0; i<len; i +=
2020 Jun 07
4
[External] Re: use of the tcltk package crashes R 4.0.1 for Windows
I've committed the change to use Free instead of free in tcltk.c and
sys-std.c (r78652 for R-devel, r78653 for R-patched).
We might consider either moving Calloc/Free out of the Windows
remapping or moving the remapping into header files so everything
seeing our header files uses our calloc/free. Either would be less
brittle that the current status.
Best,
luke
On Sun, 7 Jun 2020, peter
2013 Nov 05
1
Dynamic list creation (SEXP in C) returns error "unimplemented type (29) in 'duplicate'"
Dear R-devel,
A couple of weeks ago I started to use the R C API for package
development. Without knowing much about C, I've been able to write
some routines sucessfully... until now.
My problem consists in dynamically creating a list ("L1") of lists
using .Call, the tricky part is that each element of the "mother list"
contains two vectors (INTSXP and REALEXP types) with
2007 Nov 29
5
Solaris Zone site.xml recipe
I was finally able to get ldapnodes [1] working on our puppetmaster so i''m able to start working on the fun stuff.
In the last few days it has become critical that we come up with a better way to manage the configuration of our Solaris zones.
I am planning to write a recipe that provisions the zone [using the zone resource type], but would like to avoid having to keep a stockpile
2013 Mar 01
1
.Call interface: Use R SEXP as C mutable *char
Dear R Developers,
DISCLAIMER: I am new to package development in R and new to this list.
I am trying to do something along the lines of:
SEXP test_fun (SEXP filename) {
const char *inputfile = translateChar(STRING_ELT(filename, 0));
int abc = some_function(inputfile);
...
}
The code compiles fine, but I get a warning:
"passing argument of 'some_function' discards qualifiers
2007 Mar 07
0
13 commits - libswfdec/Makefile.am libswfdec/swfdec_js_global.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_root_movie.c libswfdec/swfdec_root_movie.h libswfdec/swfdec_script.c libswfdec/swfdec_sprite.h libswfdec/swfdec_sprite_movie.c
libswfdec/Makefile.am | 2
libswfdec/swfdec_js_global.c | 11 +++-
libswfdec/swfdec_js_movie.c | 52 +++++++++++++++++++
libswfdec/swfdec_root_movie.c | 86 +++++++++++++++------------------
libswfdec/swfdec_root_movie.h | 10 +--
libswfdec/swfdec_script.c | 4 -
libswfdec/swfdec_sprite.h | 2