klmr / box

Write reusable, composable and modular R code

Home Page:https://klmr.me/box/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inputting portions of a script

ggrothendieck opened this issue · comments

Not sure if this is within the scope of box but if box is regarded as a better way to use scripts then perhaps it is.

The feature would be to allow reading just part of a script. There would be some syntax that the script could use to define chunks and then box could source just specified chunks.

Some examples of use would be:

  • have a chunk of functions and then various chunks giving runs with alternative data. That would allow everything to be stored in a single script.
  • have a script with functions and then have alternative codes to run it with different parameters
  • have a script with functions and code to use them but then allow a second script to run just the functions without running the code to execute them so it can use its own code to run them.

Presumably there would be some syntax like this that the script could use.

#!! chunk_name
lines of code

#!! another_chunk_name
lines of code

The box command or some other command would have an argument that specifies the chunk(s) to run.