search for: findfun

Displaying 18 results from an estimated 18 matches for "findfun".

Did you mean: findfn
2008 May 24
1
value returned by findFun when the name cannot be found.
Dear list, I have been using "findVar" (defined in src/main/envir.c) happily and would like to use "findFun". However I have trouble when the name searched cannot be found: while "findVar" returns R_UnboundValue, "findFun" does not (the 4 last lines of "findFun" are copied below). error(_("could not find function \"%s\""), CHAR(PRINTNAME(symbol...
2007 Jul 04
2
problem with findFun call from embedded R
I was debugging a problem reported to me regarding PL/R, and found that I can duplicate it using only R sources. It might be characterized as possibly a misuse of the findFun() function, but I leave that for the R devel experts to decide. The below results are all with R-2.5.1 (I can't seem to download r-patched at the moment, but didn't see anything in the 2.5.1-patched release notes indicating this issue had been noticed) on Fedora Core 6 x86_64 (also dup...
2004 Oct 08
2
R-2.0.0 findVar and findFun question
...R-2.0.0 causes a problem where older versions worked OK. Rf_findVar(...) causes the following error when used to find a generic function (such as print): fun = Rf_findVar(...); R_tryEval(fun, ...); Error in function (object, ...) : Invalid generic function in usemethod Alternatively, using Rf_findFun(...) seems OK in this context, but crashes if you call it with an unexisting function name. Rf_findVar does not crash in this case, but returns an unbound value. My workaround for now is as follows: fun = Rf_findVar(Rf_install(ident), R_GlobalEnv); if (fun != R_UnboundValue) { fun...
2010 Sep 09
0
calling Rf_initEmbeddedR error
...R_NilValue; SEXP r = R_NilValue; PROTECT(e = lang2(install("source"), mkString("hreg.r"))); r = R_tryEval(e, R_GlobalEnv, NULL); // -----> success UNPROTECT(1); // Function load SEXP fun; PROTECT(e = allocVector(LANGSXP, 3)); fun = findFun(install("hreg"), R_GlobalEnv); if(fun == R_NilValue) // -----> success { UNPROTECT(1); throw std::range_error("R Function not found"); } SETCAR(e, fun); UNPROTECT(1); // End R R_dot_Last(); Rf_end...
2008 Jan 02
1
setting the seed in standalone code using Rlib
Hi, Is the below -- setSeed -- an okay way to set the seed in standalone applications making use of Rlib? It seems to work as expected. Is there a better way to do it? (I'm also looking at do_setseed but am unsure what to supply as op. findFun("set.seed", R_GlobalEnv)?) Thanks much. -- David Faden, dfaden at iastate.edu AIM: pitulx -- #include <assert.h> #include <R.h> #include <Rinternals.h> #include <R_ext/Parse.h> #include <Rmath.h> #include <stdio.h> void setSeed(unsigned int seed) {...
2007 Jan 06
1
listing all functions in R
Dear List, I'm building an R syntax highlighting file for GeSHi [*] for a website I am currently putting together. The syntax file needs a list of keywords to highlight. How can I generate a list of all the functions in a base R installation? Ideally the list would be formatted like this: "'fun1', 'fun2', 'fun3'" when printed to the screen so I can copy
2012 Jul 05
2
skipped correlation
hello,Everyone! I am a freshman to use R. Can anybody tell me where has scor function which achieves the skipped correlation? Thank you very much! Bset wishes! Jiaolong Qin [[alternative HTML version deleted]]
2015 Aug 25
0
Child thread libR.so
...up_Rmainloop(); /* end of Rf_initEmbeddedR */ /* * transposeVector above uses the R builtin function aperm instead of * looking it up every time we need deal with transposing a multidimensional * intput/output look it up once here and save it off */ aperm_function = findFun(install("aperm"), R_GlobalEnv); if (aperm_function == NULL || aperm_function == R_NilValue || aperm_function == R_UnboundValue) { aperm_function = NULL; } else { aperm_expression = PROTECT(allocVector(LANGSXP, 2)); SETCAR(aperm_expression, aperm_function);...
2010 Jan 09
4
parsing pdf files
I have a pdf file that I would like to parse into R: http://www.williams.edu/Registrar/geninfo/faculty.pdf For now, I open the file in Acrobat by hand, then save it "as text" and then use readLines(). That works fine but a) I am concerned that some information may be lost and b) I may be doing this a lot, so I would rather have R grab the information from the pdf file directly. So: is
2015 Aug 20
2
Child thread libR.so
...) init_argv); R_CStackLimit = (uintptr_t)-1; /* * transposeVector above uses the R builtin function aperm instead of * looking it up every time we need deal with transposing a multidimensional * intput/output look it up once here and save it off */ aperm_function = findFun(install("aperm"), R_GlobalEnv); if (aperm_function == NULL || aperm_function == R_NilValue || aperm_function == R_UnboundValue) { aperm_function = NULL; } else { aperm_expression = PROTECT(allocVector(LANGSXP, 2)); SETCAR(aperm_expression, aperm_function);...
1998 May 15
1
couldn't find function "print.tframe"
I have an object with an attribute "tframe" for which there is a generic method print.tframe and also a method print.tframe.default defined in a library. However, when I use attributes(object) I get the message $tframe Error: couldn't find function "print.tframe" It's as if <primitive: attributes> is not looking through the search list? Any suggestions?
2010 May 13
2
What functions are called internally in R to resolve what variable is referred?
Hello All, If I refer to a variable 'x', 'x' will be searched in the current frame or the parent frame, or the parent of the parent frame, etc., until it is found (or not found at all)? Could you please show me what code in R source that handles this? Is it in the C code or the R code? Thanks, Tom
2015 Aug 24
0
Child thread libR.so
...(uintptr_t)-1; > > /* > * transposeVector above uses the R builtin function aperm instead of > * looking it up every time we need deal with transposing a multidimensional > * intput/output look it up once here and save it off > */ > aperm_function = findFun(install("aperm"), R_GlobalEnv); > if (aperm_function == NULL || aperm_function == R_NilValue || > aperm_function == R_UnboundValue) { > aperm_function = NULL; > } else { > aperm_expression = PROTECT(allocVector(LANGSXP, 2)); > > SETCAR(...
2006 Apr 05
1
predict.smooth.spline.fit and Recall() (Was: Re: Return function from function and Recall())
Hi, forget about the below details. It is not related to the fact that the function is returned from a function. Sorry about that. I've been troubleshooting soo much I've been shoting over the target. Here is a much smaller reproducible example: x <- 1:10 y <- 1:10 + rnorm(length(x)) sp <- smooth.spline(x=x, y=y) ypred <- predict(sp$fit, x) # [1] 2.325181 2.756166 ...
2008 Apr 29
2
Calling R from C - part way there but need a push!
Dear All, I've read the manual on "Writing R Extensions" and in particular the part on calling R from C. (Most of the manual is about calling C from R, not the other way around.) The good news is that I can now call _some_ R from C, specifically the R functions which have C header files. However it isn't clear to me how to call R functions that are written in R. I
2010 Mar 05
2
Writing own simulation function in C
I am wishing to write my own random distribution simulation function using C programmin language(for speed) via R. I am familiar with R programming but somewhat new to C programming. I was trying to understand "Writing R extensions" -guide and its part 6.16, but I found it hard to understand(http://cran.r-project.org/doc/manuals/R-exts.html#Standalone-Mathlib). I also tried to get
2010 Sep 03
0
Pointer to fourteen patches to speed up R
...begin with a character other than a letter or ".", by allowing fast bypass of non-global environments that do not contain (and have never contained) symbols of this sort. Since it is expected that only functions will be given names of this sort, the check is done only in findFun, though it could also be done in findVar. Relevant timing test scripts: all of them, but will look at test-em.r On test-em.r, the speedup from this patch is about 8%. Issue: This patch uses the "spare" bit to flag environments known to not have symbols starti...
2010 Sep 03
1
Fourteen patches to speed up R
...begin with a character other than a letter or ".", by allowing fast bypass of non-global environments that do not contain (and have never contained) symbols of this sort. Since it is expected that only functions will be given names of this sort, the check is done only in findFun, though it could also be done in findVar. Relevant timing test scripts: all of them, but will look at test-em.r On test-em.r, the speedup from this patch is about 8%. Issue: This patch uses the "spare" bit to flag environments known to not have symbols starti...