Several files and packages
Load your own functions from another file with source(), and which packages are available without installing.
Runs in Zerethon IDE · R 4.5
Official R documentation ↗
main.R
source("geometry.R")
print(area(3, 4))
print(round(pi, 3))
geometry.R
area <- function(width, height) {
width * height
}
Output
[1] 12 [1] 3.142
main.R (the entry, run by Run) and geometry.R next to it.
source("file.R")runs the file, so its functions and variables are defined afterwards. The path is relative to the project root.- Base R and the recommended packages are available:
stats,utils,MASS,lattice,Matrix,survivaland the rest of the standard R installation. install.packages()does not work: runs have no network, so CRAN packages such asdplyrorggplot2cannot be added.