On Sun, 22 Oct 2006, Deepayan Sarkar wrote:
> On 10/22/06, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
>> On 10/22/2006 3:56 PM, Deepayan Sarkar wrote:
>>> Hi,
>>>
>>> I have a package where I'm calling an R function (say "foo") from C
>>> code. "foo" is in the same package, but is not exported. I c
Try this. If the first arg of FUN is x then it increments it.
incrx <- function (e) {
is.node <- function(x) is.symbol(x) || is.double(x)
if (is.node(e)) return(e)
if (is.name(e[[1]]) && e[[1]] == as.name("FUN") && names(e)[2] == "x")
e[[2]] <- e[[2]] + 1
for (i in 1:lengt
Seth Falcon <[EMAIL PROTECTED]> writes:
> Perhaps:
>
> R_FindNamespace(mkString(where))
Sorry, this won't help you for package-level code as this function is
part of the internal use only API. It would be nice to have access to
it or a similar function from C in package code.
___
"Deepayan Sarkar" <[EMAIL PROTECTED]> writes:
> On 10/22/06, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
>> In R code, you could use getNamespace("pkg") to get the namespace
>> environment. I haven't tried this, but I'd assume
>>
>> PROTECT(rho = eval(lang2(install("getNamespace"),
>>
See
?body
?parse
?deparse
?gsub
> foo <- function(x) x+.1
> bar <- function(y) y+foo(x=1) + foo(x=2)
> bar(1)
[1] 4.2
> body(bar)
y + foo(x = 1) + foo(x = 2)
> body(bar) <- parse(text=gsub("x[ ]*=[ ]*([0-9])","x = 1 +
> \\1",deparse(body(bar
> bar(1)
[1] 6.2
R-Developers,
I'm looking for some help computing on the R language.
I'm hoping to write a function that parses a language or expression
object and returns another expression with all instances of certain
argument of a given function altered. For instance, say I would like my
function, myFun to ta
Hi all.
I've seen that, on my R installation, utils::methods doesn't list
methods of generics whose name begins with a dot, and I can't see that
mentioned in utils::methods help page.
Antonio.
#
> .foo <- function(x, ...) UseMethod(".foo")
> .foo.bar <- fun
On 10/22/2006 3:56 PM, Deepayan Sarkar wrote:
> Hi,
>
> I have a package where I'm calling an R function (say "foo") from C
> code. "foo" is in the same package, but is not exported. I construct
> the call using lang1(install("foo")), but to eval it I need the
> package's environment. Is there a
Hi,
I have a package where I'm calling an R function (say "foo") from C
code. "foo" is in the same package, but is not exported. I construct
the call using lang1(install("foo")), but to eval it I need the
package's environment. Is there a way to do this? Passing the correct
environment through .C
On 10/22/06, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
> On 10/22/2006 3:56 PM, Deepayan Sarkar wrote:
> > Hi,
> >
> > I have a package where I'm calling an R function (say "foo") from C
> > code. "foo" is in the same package, but is not exported. I construct
> > the call using lang1(install("foo")
10 matches
Mail list logo