Marta Karas
Marta Karas

Reputation: 5165

What is the best practice in attaching R scripts with examples to an R package?

I wonder what is the best practice in attaching R scripts with examples to an R package. I mean R script with examples such as:

I am not sure if there are any other "elegant" ways of including such examples.

Upvotes: 3

Views: 90

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368439

I would use

  • the demo/ directory, or
  • an inst/examples/ directory

The former leads to use by demo() and has some extra requirements spelled out in Writing R Extensions, the latter is simpler.

Lastly you of course just write a vignette document ...

Upvotes: 4

Related Questions