search for: rf_printvalu

Displaying 20 results from an estimated 21 matches for "rf_printvalu".

Did you mean: rf_printvalue
2007 Apr 07
2
Rf_PrintValue problem with methods::show
Hi, I think this is a bug (even though I can't find documentation explicitly saying that it should work). Basically, Rf_PrintValue(obj) fails when 'obj' is an S4 object that should be printed using show() rather than print(). From the error message I'm guessing that the need to use show is detected correctly but then show is not found. "cbind2" in the code below is just a representative object, the same...
2009 Jun 26
1
bug in Rf_PrintValue ?
I'm very green with R, so maybe this is not a bug, but it looks like one to me. The following program segfaults at the second call to Rf_PrintValue(). To failure depends on the value of the y-string. E.g., if I change it from "coverage" to, say, "COVERAGE", the segfault does not occur. /* bug.c */ #include <stdio.h> #include <Rinternals.h> #include <Rembedded.h> int main(int argc, char **argv) { cha...
2009 Aug 25
2
Clarifications please.
...T(e = lang2(install("library"), mkString("fPortfolio"))); R_tryEval(e, R_GlobalEnv, NULL); UNPROTECT(1); // colMeans(SWX.RET) PROTECT(e = lang2(install("colMeans"), install("SWX.RET"))); val = (R_tryEval(e, NULL, &errorOccurred)); Rf_PrintValue(val); return 0; } When I tried : >mean(SWX.RET) in the R prompt I got the following output: SBI SPI SII LP25 LP40 LP60 4.660521e-06 2.153198e-04 2.033869e-04 1.388886e-04 1.349041e-04 1.226859e-04 However when I replaced colMeans with mean...
2008 May 06
3
a R_PV problem
Dear all, When using gdb to debug my C code, I use R_PV to show the content of SEXP variables: SEXP sexp; // it is a data.frame SEXP colNames = getAttrib(sexp, R_NameSymbol); A strange thing is that after halting the program: (gdb) p R_PV(colNames) does not show the content of colNames. I am positive my code is right because if I insert "PrintValue(colNames);" in the c code,
2020 Jun 30
3
Build a R call at C level
...language = "C", > sig = c(x = "SEXP"), body = " > > SEXP e = PROTECT(lang2(install(\"sum\"), x)); > SEXP r_true = PROTECT(CONS(ScalarLogical(1), R_NilValue)); > SETCDR(CDR(e), r_true); > SET_TAG(CDDR(e), install(\"na.rm\")); > Rf_PrintValue(e); > SEXP ans = PROTECT(eval(e, R_GlobalEnv)); > UNPROTECT(3); > return ans; > > ") > > call_to_sum(c(1L,NA,3L)) > > On Tue, Jun 30, 2020 at 10:08 AM Morgan Morgan > <morgan.emailbox at gmail.com> wrote: >> Hi All, >> >> I was reading the...
2020 Sep 11
4
Garbage collection of seemingly PROTECTed pairlist
..._mat_int, nr, 2, 1)); SEXP prlst = PROTECT(Rf_list1(prlst0cdr)); SEXP prlst_tail = prlst; last = INTEGER(prlst0cdr)[1]; row_num = 2; while (row_num <= nr) { Rprintf("row_num: %i\n", row_num); SEXP row = PROTECT(C_int_mat_nth_row_nrnc(int_mat_int, nr, 2, row_num)); Rf_PrintValue(prlst); // This is where the error occurs int *row_int = INTEGER(row); if (row_int[0] == last + 1) { Rprintf("here1"); SEXP next = PROTECT(Rf_list1(row)); prlst_tail = SETCDR(prlst_tail, next); last = row_int[1]; UNPROTECT(1); ++row_num; }...
2023 Apr 29
1
Forcing a PROTECT Bug to Occur
...I can't make either happen. Here's my current code (all in R, using the inline package for simplicity): > gctorture(TRUE) > z = inline::cfunction(body=" SEXP vec_1 = Rf_ScalarInteger(99); SEXP vec_2 = Rf_allocVector(VECSXP, 10); SET_VECTOR_ELT(vec_2, 1, vec_1); Rf_PrintValue(vec_2); ") My thinking was that, with torture mode enabled, the allocation of vec_2 should ensure that vec_1 is collected, and then trying to put it into vec_2 and then print it would then fail. But it consistently prints 99 in the list's second element. Why does this code not have issu...
2013 May 24
0
Rcpp with OpenMP - Need example Makevars
...ously compilation fails with error: R CMD INSTALL OpenMPTest Symbol not found: __ZTIN4Rcpp19index_out_of_boundsE With standard setup of the above Makevars I get the Symbol not found: omp_set_num_threads Inline also does not work: fb <- 'omp_set_num_threads(10); + #pragma omp parallel + { Rf_PrintValue(wrap("HALLO JUPP")); } + ' > funk <- cxxfunction( signature(), body=fb, plugin='Rcpp' ) error: ‘omp_set_num_threads’ was not declared in this scope How do set the PKG_LIBS -and eventually other variables- to all required values in a single statement? Could anyone pro...
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
2020 Jun 30
0
Build a R call at C level
...call_to_sum <- inline::cfunction( language = "C", sig = c(x = "SEXP"), body = " SEXP e = PROTECT(lang2(install(\"sum\"), x)); SEXP r_true = PROTECT(CONS(ScalarLogical(1), R_NilValue)); SETCDR(CDR(e), r_true); SET_TAG(CDDR(e), install(\"na.rm\")); Rf_PrintValue(e); SEXP ans = PROTECT(eval(e, R_GlobalEnv)); UNPROTECT(3); return ans; ") call_to_sum(c(1L,NA,3L)) On Tue, Jun 30, 2020 at 10:08 AM Morgan Morgan <morgan.emailbox at gmail.com> wrote: > > Hi All, > > I was reading the R extension manual section 5.11 ( Evaluating R expres...
2020 Jun 30
0
Build a R call at C level
...> sig = c(x = "SEXP"), body = " > > > > SEXP e = PROTECT(lang2(install(\"sum\"), x)); > > SEXP r_true = PROTECT(CONS(ScalarLogical(1), R_NilValue)); > > SETCDR(CDR(e), r_true); > > SET_TAG(CDDR(e), install(\"na.rm\")); > > Rf_PrintValue(e); > > SEXP ans = PROTECT(eval(e, R_GlobalEnv)); > > UNPROTECT(3); > > return ans; > > > > ") > > > > call_to_sum(c(1L,NA,3L)) > > > > On Tue, Jun 30, 2020 at 10:08 AM Morgan Morgan > > <morgan.emailbox at gmail.com> wrote: &g...
2005 Jul 12
1
Spurious output like <environment: namespace:base> in R-devel
I have noticed spurious message of the form <environment: namespace:base> when developing code for the Matrix package and testing under R-devel. These messages are not present when testing under R-2.1.1 I have not reported this because I didn't know if it was caused by my code in the Matrix package or some other code. Today I checked the newly uploaded vcd package under R-devel and
2008 Jul 18
0
Rcpp from C++
...seVector(cmdSexp, -1, &status, R_NilValue)); if (status != PARSE_OK) { UNPROTECT(2); error("invalid call!"); } for(int i = 0; i < length(cmdexpr); i++) { ans = eval(VECTOR_ELT(cmdexpr, i), R_GlobalEnv); Rf_PrintValue(ans); } } hope that helps best peter P.S.: let me know if that works and what you find out!
2009 Jun 25
1
R data inspection under gdb?
Hi, everyone. I'm trying to debug an R-module, written in C, and I'm using gdb for this. How can I print "standard" R objects from within C code? BTW, I'm familiar with the advice to use R_PV given in Writing R Extensions, but it's not working for me. E.g., I get (gdb) p R_PV(x) $1 = void and yet (gdb) p *x $2 = {sxpinfo = {type = 16, obj = 0, named = 0, gp = 0,
2020 Sep 12
0
Garbage collection of seemingly PROTECTed pairlist
...TECT(Rf_list1(prlst0cdr)); > SEXP prlst_tail = prlst; > last = INTEGER(prlst0cdr)[1]; > row_num = 2; > while (row_num <= nr) { > Rprintf("row_num: %i\n", row_num); > SEXP row = PROTECT(C_int_mat_nth_row_nrnc(int_mat_int, nr, 2, > row_num)); > Rf_PrintValue(prlst); // This is where the error occurs > int *row_int = INTEGER(row); > if (row_int[0] == last + 1) { > Rprintf("here1"); > SEXP next = PROTECT(Rf_list1(row)); > prlst_tail = SETCDR(prlst_tail, next); > last = row_int[1]; > U...
2009 Aug 25
1
R command line behaving funny
...dR(argc, argv); PROTECT(e = lang2(install("library"), mkString("fPortfolio"))); R_tryEval(e, R_GlobalEnv, NULL); UNPROTECT(1); PROTECT(e = lang2(install("cov"), install("SWX.RET"))); val = (R_tryEval(e, NULL, &errorOccurred)); Rf_PrintValue(val); return 0; } Output: R version 2.9.1 (2009-06-26) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'l...
2023 Apr 30
0
Forcing a PROTECT Bug to Occur
...simplicity): > > > >> gctorture(TRUE) > >> z = inline::cfunction(body=" > >? ? ? SEXP vec_1 = Rf_ScalarInteger(99); > >? ? ? SEXP vec_2 = Rf_allocVector(VECSXP, 10); > >? ? ? SET_VECTOR_ELT(vec_2, 1, vec_1); > >? ? ? Rf_PrintValue(vec_2); > > ") > > > > My thinking was that, with torture mode enabled, the allocation > of vec_2 > > should ensure that vec_1 is collected, and then trying to put it > into vec_2 > > and then print it would then fail. But it con...
2013 Feb 08
2
How to debug the C programs associated with R-packages?
hello, I was having some problems in debugging C codes assocaited with R-packages. I don't have much experience with debugging tools used in C language. Is there any methods similar to R-debugging tools such as browser ,debug etc which can be used to debug such C files. I was using the foreign package and found a bug in reading dta files containing empty strings "" in the data. I
2007 Jan 18
0
Emulating a REPL in frontends
...y will probably want to auto-print values for most statements (i.e. print them if and only if R_Visible is TRUE). - There does not seem to be a good way (from the C-API) to do auto-printing of values outside of R_ReplDLLdo1(): R_Visible is not exported any longer, and PrintValueEnv() is neither. Rf_PrintValue() should yield the same results as PrintValueEnv() in most, but probably not all cases. - From R API, withVisible() provides a way to emulate auto-printing, but with the drawback that wrapping all statements inside withVisible() makes potential errors harder to read (you get something like &quo...
2010 May 06
1
R on kdeedu-svn library problem
...; $SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:226: undefined reference to `Rf_protect' $SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:261: undefined reference to `Rf_unprotect' $SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:275: undefined reference to `Rf_PrintValue' $SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:234: undefined reference to `VECTOR_ELT' $SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:234: undefined reference to `R_tryEval' $SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:232: undefined reference to...