I know I can put them into a vignette, but the advantage of demo files is that
you can run them using demo().
It just seems like the facilities for demo files were abandoned.
-Michael
-----Original Message-----
From: Duncan Murdoch <murdoch.duncan at gmail.com>
Sent: January 24, 2026 6:02 PM
To: Michael L Friendly <friendly at yorku.ca>; R-help at r-project.org
Subject: Re: [R] Demo files in R packages
On 2026-01-24 4:49 p.m., Michael L Friendly wrote:> Before vignettes were established as a way to document a package, there
were demos, R files in a `demo/` folder with a `demo/00-Index` file giving their
contents.
> Used as `demo(package="...")` this gave a window with a list and
titles, and `demo("example1", package="...") ran
`demo/example1.R` in the console.
> It was also a good way to give a pointer to something more extensive than
you wanted to include in the examples for a function or dataset.
>
> This idea still works for R packages, but is not available for use in
roxygen2 documentation, or pkgdown sites.
> I have several packages with collections of demo/ files, and am wondering
if there is anything further I can do with them to make them accessible.
I converted most of my demo files in rgl to a single vignette. I just added a
simple paragraph
> This vignette holds code that was previously included as "demos"
> in `rgl`. Some of the demos require R to be running; those remain
> available via `demo(package = "rgl")`.
As the second sentence indicates, rgl still has a few demos, mostly Shiny
examples.
Conversion was simple: just copy the title into a heading, and include all the
code.
Duncan Murdoch