Displaying 2 results from an estimated 2 matches for "thingy2".
Did you mean:
thingy
1999 Jun 07
2
R equiv of #ifdef?
I was wondering if R has an equivalent of #ifdef.
I want the code to check if a function has been sourced in yet, and if
not, then source it in. (I know of replace(), which works for
packages/libraries)
Here is what I have come up with.
my.objects<-objects()
if(my.objects[my.objects=="thingy2"]!="thingy2")
source("~/papers/speed/junk.r")
junk.r contains the code for function thingy2().
This doesn't work: "missing value where logical needed"
The error message puzzles me.
>my.objects[my.objects=="thingy2"]!="thingy2"
logical...
1997 Sep 25
2
R-beta: return()
I have a question on the use of return(). (Nothing on it in the docs I
have)
The test code below gives the error: Error: Object "x" not found
when I do: thingy2().
How should it be fixed? Thanks very much for any help!
(My original solution to this sort of problem was to use global variables
x<<-...
y<<-...)
Bill Simpson
-----------------------------
thingy<-function(k)
{
x<-5+k
y<-5-k
return(list(x=x,y=y))
}
thingy2<-function()...