Sourcing code blocks from an internal file #555
-
I would like to just make a single block of code to source from demo to demo, to generate the tree populations. I know how to do this in an R 'project', but the file structure of the packages is very formal, and I'm worried about disrupting that. Should such a file just go in the demo folder, and get called as "demo/filename"? Or in the general whole-package folder, and just called as "filename"? Or somewhere else? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@mhuzzell - it's an interesting idea to do that. The simplest solution is to put it into the |
Beta Was this translation helpful? Give feedback.
@mhuzzell - it's an interesting idea to do that. The simplest solution is to put it into the
demo
folder as you suggest. Alternatives include putting it into aninst
folder - the contents of that folder get automatically installed with the packages, but can be hard to source those files correctly so don't worry if you find that too complex. The final(?) alternative is to write a function that returns the tree populations, which is handled just like all of the other functions you write in a package.