0

I am using an R script that someone sent me. This is not a big package but just one function. To use it, I source the file.

However,whenever I restart R, I must type in source("directory") again to use the function.

Is there any way I can avoid this and set that function permanently?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Concerned_Citizen
  • 6,548
  • 18
  • 57
  • 75

1 Answers1

3

I think that you just want to add source("directory") to your .Rprofile so that the function gets loaded at startup.

See this SO question for some handy things you can do with .Rprofile.

Community
  • 1
  • 1
kmm
  • 6,045
  • 7
  • 43
  • 53