Skip to content

Commit

Permalink
doc: improve manual with cross-refs links
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgohel committed Jan 11, 2025
1 parent e4100d9 commit a511366
Show file tree
Hide file tree
Showing 17 changed files with 111 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release'}

Expand Down
5 changes: 5 additions & 0 deletions R/readers.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#' z <- store_dataset(x = z, dataset = iris, name = "iris_dataset")
#' z <- store_dataset(x = z, dataset = mtcars, name = "mtcars")
#' list_object_in_workspace(z)
#' @family functions to read in a workspace
list_object_in_workspace <- function(x) {
objects_descriptions <- read_objects_description(x)
objects_descriptions
Expand All @@ -31,6 +32,7 @@ list_object_in_workspace <- function(x) {
#' z <- store_dataset(x = z, dataset = iris, name = "iris_dataset")
#' z <- store_dataset(x = z, dataset = mtcars, name = "mtcars")
#' read_dataset_in_workspace(z, name = "mtcars")
#' @family functions to read in a workspace
read_dataset_in_workspace <- function(x, name) {
objs <- list_object_in_workspace(x)
objs <- objs[objs$type %in% "dataset", ]
Expand Down Expand Up @@ -68,6 +70,7 @@ read_dataset_in_workspace <- function(x, name) {
#' subdir = "r-object"
#' )
#' read_rds_in_workspace(z, name = "obj")
#' @family functions to read in a workspace
read_rds_in_workspace <- function(x, name, subdir = NULL) {
objs <- list_object_in_workspace(x)
objs <- objs[objs$type %in% "rds", ]
Expand Down Expand Up @@ -114,6 +117,7 @@ read_rds_in_workspace <- function(x, name, subdir = NULL) {
#' subdir = "blah"
#' )
#' read_json_str_in_workspace(z, "an_example")
#' @family functions to read in a workspace
read_json_str_in_workspace <- function(x, name, subdir = NULL) {
objs <- list_object_in_workspace(x)
objs <- objs[objs$type %in% "json", ]
Expand Down Expand Up @@ -155,6 +159,7 @@ read_json_str_in_workspace <- function(x, name, subdir = NULL) {
#' subdir = "r-object"
#' )
#' read_timestamp(z, name = "obj", type = "rds", subdir = "r-object")
#' @family functions to read in a workspace
read_timestamp <- function(x, name, type, subdir = NULL) {
objs <- list_object_in_workspace(x)
objs <- objs[objs$type %in% type, ]
Expand Down
3 changes: 3 additions & 0 deletions R/store.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#' z <- store_dataset(x = z, dataset = iris, name = "iris_dataset")
#' z <- store_dataset(x = z, dataset = mtcars, name = "mtcars")
#' z
#' @family functions to write in a workspace
store_dataset <- function(x, dataset, name, timestamp = format(Sys.time(), "%Y-%m-%d %H:%M:%S")) {

base_file <- stri_trans_general(name, id = "latin-ascii")
Expand Down Expand Up @@ -76,6 +77,7 @@ store_dataset <- function(x, dataset, name, timestamp = format(Sys.time(), "%Y-%
#' subdir = "blah"
#' )
#' z
#' @family functions to write in a workspace
store_json <- function(x, json_str, filename, name = NULL, subdir, timestamp = format(Sys.time(), "%Y-%m-%d %H:%M:%S")) {

if (!is_string(json_str)) {
Expand Down Expand Up @@ -151,6 +153,7 @@ store_json <- function(x, json_str, filename, name = NULL, subdir, timestamp = f
#' subdir = "r-object"
#' )
#' z
#' @family functions to write in a workspace
store_rds <- function(x, obj, filename, name = NULL, subdir, timestamp = format(Sys.time(), "%Y-%m-%d %H:%M:%S")) {

if (!is_string(filename)) {
Expand Down
5 changes: 5 additions & 0 deletions R/workspace.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ as_workspace_structure <- function(dir, obj_desc, version) {
#' @examples
#' z <- new_workspace()
#' z
#' @family functions to manage workspaces
new_workspace <- function(dir = tempfile(pattern = "ws")) {

if (dir.exists(dir)) {
Expand Down Expand Up @@ -126,6 +127,7 @@ new_workspace <- function(dir = tempfile(pattern = "ws")) {
#' )
#' file <- tempfile(fileext = ".zip")
#' pack_workspace(x = z, file = file)
#' @family functions to manage workspaces
pack_workspace <- function(x, file) {
pack_folder(x$dir, target = file)
}
Expand Down Expand Up @@ -167,6 +169,7 @@ pack_workspace <- function(x, file) {
#'
#' z <- unpack_workspace(file = file)
#' z
#' @family functions to manage workspaces
unpack_workspace <- function(file) {

dir <- tempfile(pattern = "ws")
Expand Down Expand Up @@ -306,6 +309,7 @@ print.workspace <- function(x, ...) {
#' )
#'
#' new_z <- workspace_copy(z)
#' @family functions to manage workspaces
workspace_copy <- function(x) {
file <- tempfile(fileext = ".zip")
pack_workspace(x = x, file = file)
Expand Down Expand Up @@ -352,6 +356,7 @@ workspace_copy <- function(x) {
#'
#' new_x <- workspace_bind(x, z)
#' new_x
#' @family functions to manage workspaces
workspace_bind <- function(x, y, replace = FALSE) {

if (!inherits(x, "workspace")) {
Expand Down
8 changes: 8 additions & 0 deletions man/list_object_in_workspace.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/new_workspace.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/pack_workspace.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/read_dataset_in_workspace.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/read_json_str_in_workspace.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/read_rds_in_workspace.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/read_timestamp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions man/store_dataset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions man/store_json.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions man/store_rds.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/unpack_workspace.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/workspace_bind.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/workspace_copy.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a511366

Please sign in to comment.