### Get path to example source
examplePath <-
system.file("extdata", package="rock");
### Get a path to one example file
exampleFile <-
file.path(examplePath, "example-1.rock");
### Get a temporary file to write to
tempFile <- tempfile(fileext = ".rock")
### Pipe chain to load the example source; add a code;
### and write the result to disk
loadedSource <-
rock::load_source(exampleFile) |>
rock::code_source(c("Lorem Ipsum" = "lorumIpsum")) |>
rock::write_source(tempFile);
Run the code above in your browser using DataLab