Skip to contents

Show a file from within one of the examples. This function exists for use within orderly help files, vignettes and tutorials and is not meant to form part of your workflows, unless you are doing something very peculiar.

Usage

orderly_example_show(name, file = NULL, example = "demo")

Arguments

name

The name of the report within the example.

file

The name of the file within the report. The default is to show the main orderly file (i.e., <name>.R)

example

The name of the example to look in. The default demo is a sprawling set of source designed to show off different orderly features.

Value

Nothing, called for its side effects only.

Details

All orderly examples here are runnable, though some will naturally have some pre-requisites (e.g., using a dependency will require that the dependency has been run first).

Examples

# We use constructions like this in the help, to show off features
# of orderly:
orderly_example_show("data")
#> 
#> ── src/data/data.R ─────────────────────────────────────────────────────────────
#> orderly_description(
#>   display = "A demo data set")
#>  
#> x <- jitter(1:30)
#> y <- 0.4 * x + 5 + rnorm(length(x), sd = 2)
#> d <- data.frame(x, y)
#>  
#> orderly_artefact("data.rds", description = "A synthetic dataset")
#> saveRDS(d, "data.rds")

# You can run this example:
path <- orderly_example()
#>  Created orderly root at '/tmp/Rtmp3NBL3X/orderly2_ex_1cf14a8fc643'
orderly_run("data", root = path)
#>  Starting packet 'data' `20250807-155615-8ede5322` at 2025-08-07 15:56:15.562526
#> > orderly_description(
#> +   display = "A demo data set")
#> > x <- jitter(1:30)
#> > y <- 0.4 * x + 5 + rnorm(length(x), sd = 2)
#> > d <- data.frame(x, y)
#> > orderly_artefact("data.rds", description = "A synthetic dataset")
#> > saveRDS(d, "data.rds")
#>  Finished running data.R
#>  Finished 20250807-155615-8ede5322 at 2025-08-07 15:56:15.587683 (0.02515745 secs)
#> [1] "20250807-155615-8ede5322"