Reputation: 1769
I wrote a function:
funct1<-function(input1,input2,input3){
...
}
which uses another function, funct2
, i.e. funct2
is within funct1
. Their codes are stored in two different files inside the same directory; respectively: funct1.R
and funct2.R
.
I've got the following error when launching funct1
:
Error: could not find function "funct2"
How can I solve it?
Upvotes: 0
Views: 401
Reputation: 1268
You need to make sure you load the script for funct2 before you try and use it in funct1. Like RLave has said in his comment use source("path_to/funct2.R"). You can put this within funct1 or at the top of your script for funct1.
Upvotes: 3