I am using the testthat
package in R and I am trying to test a function
defined in a file example.R
. This file contains a call source("../utilities/utilities.R")
where utilities.R
is a file with functions written by me. However, when I am trying to test a function from example.R
, sourcing it within the testing script gives the following error:
Error in file(filename, "r", encoding = encoding) :
cannot open the connection
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
cannot open file '../utilities/utilities.R': No such file or directory
Could you please clarify how to run tests for functions in files that source another file?
source("utilities.R")
inexample.R
does not help: I get a similar error message. – Tedie