Skip to content
Prev 155758 / 398503 Next

How to load functions in R

I would recommend saving the functions into a separate file and then 
using source() as bartjoosen suggested.

I do not recommend using save() here because the output is non-readable 
(even when using ascii=TRUE option). Which means that you have to load() 
it, then copy-and-paste into an editor before making changes and then 
running it again in R and then save() again.

Another better option is to consider making your own package. It may 
sound complicated but once you mastered it, it makes your functions more 
portable and encourages you to document it. Further, the function 
package.skeleton() simplifies much of it.

Regards, Adai
Yihui Xie wrote: