Loading R functions from source

code
beginner
r
tips
Author

Daniel Kick

Published

April 1, 2020

You can keep your working Rmd easier to navigate and less buggy by 1) packaging code into functions and 2) adding them to a companion Rfile. Load your functions with source() in the same block you load your libraries with a relative path, full path, or ideally with here().

library(here)
source(here("R", "02MoniterGapJunction.R")) #here's output is effectively ../R/02MoniterGapJunction.R