Skip to content

Commit 6cd1a9d

Browse files
committed
docs: add links to package man throughout
1 parent 855ee38 commit 6cd1a9d

24 files changed

+109
-35
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: workspace
22
Title: Manage Collections of Datasets and Objects
3-
Version: 0.1.5.002
3+
Version: 0.1.5.003
44
Authors@R: c(
55
person("Eli", "Daniels", , "[email protected]", role = c("aut", "cre")),
66
person("David", "Gohel", , "[email protected]", role = "aut"),

R/readers.R

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
#' List all objects stored in a workspace object and
55
#' returns results as a tibble.
66
#' @param x the workspace
7-
#' @return Tibble listing workspace contents.
7+
#' @return Tibble object containing the following columns:
8+
#' - `file`: file path to stored object relative to workspace directory
9+
#' - `name`: name given to object upon storing
10+
#' - `subdir`: subdirectory of file, such as 'datasets' or 'assets'.
11+
#' - `type`: file type such as 'dataset', 'geospatial', 'yaml', etc...
12+
#' - `timestamp`: timestamp of last modification
813
#' @examples
914
#' library(workspace)
1015
#' dir_tmp <- tempfile(pattern = "ws")
@@ -13,6 +18,7 @@
1318
#' z <- store_dataset(x = z, dataset = mtcars, name = "mtcars")
1419
#' list_object_in_workspace(z)
1520
#' @family functions to read in a workspace
21+
#' @seealso [workspace] for package documentation
1622
list_object_in_workspace <- function(x) {
1723
objects_descriptions <- read_objects_description(x)
1824
objects_descriptions
@@ -26,8 +32,9 @@ list_object_in_workspace <- function(x) {
2632
#' in a workspace.
2733
#' @param x the workspace
2834
#' @param name name of the dataset stored in the workspace
29-
#' @return a `tibble` if the dataset is stored as parquet, and a
30-
#' `sf` object if it is stored as a geospatial dataset.
35+
#' @return A `tibble` if the dataset is stored as parquet, and a
36+
#' `sf` object if it is stored as a geospatial dataset
37+
#' (see [store_dataset()] for details).
3138
#' @examples
3239
#' library(workspace)
3340
#' dir_tmp <- tempfile(pattern = "ws")
@@ -36,6 +43,7 @@ list_object_in_workspace <- function(x) {
3643
#' z <- store_dataset(x = z, dataset = mtcars, name = "mtcars")
3744
#' read_dataset_in_workspace(z, name = "mtcars")
3845
#' @family functions to read in a workspace
46+
#' @seealso [workspace] for package documentation
3947
read_dataset_in_workspace <- function(x, name) {
4048
objs <- list_object_in_workspace(x)
4149
objs <- objs[objs$type %in% c("dataset", "geospatial"), ]
@@ -85,7 +93,7 @@ read_dataset_in_workspace <- function(x, name) {
8593
#' Read a raster dataset stored as a TIFF file in a workspace.
8694
#' @param x the workspace object
8795
#' @param name name of the raster dataset stored in the workspace
88-
#' @return a `splatRaster` object
96+
#' @return The `splatRaster` object that was stored in TIFF format.
8997
#' @examples
9098
#' library(workspace)
9199
#' dir_tmp <- tempfile(pattern = "ws")
@@ -98,6 +106,7 @@ read_dataset_in_workspace <- function(x, name) {
98106
#' retrieved_raster
99107
#' }
100108
#' @family functions to read in a workspace
109+
#' @seealso [workspace] for package documentation
101110
read_raster_in_workspace <- function(x, name) {
102111

103112
if (!requireNamespace("terra", quietly = TRUE)) {
@@ -146,7 +155,7 @@ read_raster_in_workspace <- function(x, name) {
146155
#' @param x the workspace
147156
#' @param name name of the object stored in the workspace
148157
#' @param subdir Optional subdirectory used for the asset to retrieve
149-
#' @return the R object
158+
#' @return the R object that was stored as an Rds file.
150159
#' @examples
151160
#' library(workspace)
152161
#' dir_tmp <- tempfile(pattern = "ws")
@@ -161,6 +170,7 @@ read_raster_in_workspace <- function(x, name) {
161170
#' )
162171
#' read_rds_in_workspace(z, name = "obj")
163172
#' @family functions to read in a workspace
173+
#' @seealso [workspace] for package documentation
164174
read_rds_in_workspace <- function(x, name, subdir = NULL) {
165175
objs <- list_object_in_workspace(x)
166176
objs <- objs[objs$type %in% "rds", ]
@@ -188,7 +198,7 @@ read_rds_in_workspace <- function(x, name, subdir = NULL) {
188198
#' @param x the workspace
189199
#' @param name name associated with the json file stored in the workspace
190200
#' @param subdir Optional subdirectory used for the asset to retrieve
191-
#' @return a character string containing the JSON string.
201+
#' @return A character string containing the JSON string.
192202
#' @examples
193203
#' library(workspace)
194204
#' dir_tmp <- tempfile(pattern = "ws")
@@ -209,6 +219,7 @@ read_rds_in_workspace <- function(x, name, subdir = NULL) {
209219
#' )
210220
#' read_json_str_in_workspace(z, "an_example")
211221
#' @family functions to read in a workspace
222+
#' @seealso [workspace] for package documentation
212223
read_json_str_in_workspace <- function(x, name, subdir = NULL) {
213224
objs <- list_object_in_workspace(x)
214225
objs <- objs[objs$type %in% "json", ]
@@ -242,7 +253,7 @@ read_json_str_in_workspace <- function(x, name, subdir = NULL) {
242253
#' @param x the workspace
243254
#' @param name name associated with the YAML file stored in the workspace
244255
#' @param subdir Optional subdirectory used for the asset to retrieve
245-
#' @return a list
256+
#' @return A list object as read from the stored YAML file.
246257
#' @examples
247258
#' library(workspace)
248259
#' dir_tmp <- tempfile(pattern = "ws")
@@ -268,6 +279,7 @@ read_json_str_in_workspace <- function(x, name, subdir = NULL) {
268279
#' )
269280
#' read_yaml_in_workspace(z, "app_config", subdir = "configs")
270281
#' @family functions to read in a workspace
282+
#' @seealso [workspace] for package documentation
271283
read_yaml_in_workspace <- function(x, name, subdir = NULL) {
272284

273285
objs <- list_object_in_workspace(x)
@@ -295,14 +307,15 @@ read_yaml_in_workspace <- function(x, name, subdir = NULL) {
295307

296308

297309
#' @export
298-
#' @title Read Timestamp associated with a content of a Workspace.
310+
#' @title Read Timestamp associated with an object in a workspace.
299311
#' @description
300-
#' Read a timestamp associated with a content located in a Workspace.
312+
#' Read a timestamp associated with an object in a workspace.
301313
#' @param x the workspace
302314
#' @param name name of the object stored in the workspace
303315
#' @param type content type
304316
#' @param subdir Optional subdirectory used for the asset to retrieve
305-
#' @return character string of timestamp
317+
#' @return A character string corresponding to the timestamp (date last modified)
318+
#' of the stored object.
306319
#' @examples
307320
#' library(workspace)
308321
#' dir_tmp <- tempfile(pattern = "ws")
@@ -317,6 +330,7 @@ read_yaml_in_workspace <- function(x, name, subdir = NULL) {
317330
#' )
318331
#' read_timestamp(z, name = "obj", type = "rds", subdir = "r-object")
319332
#' @family functions to read in a workspace
333+
#' @seealso [workspace] for package documentation
320334
read_timestamp <- function(x, name, type, subdir = NULL) {
321335
objs <- list_object_in_workspace(x)
322336
objs <- objs[objs$type %in% type, ]

R/rm.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' @param name name of the object stored in the workspace
88
#' @param type content type
99
#' @param subdir Optional subdirectory used for the asset to retrieve
10-
#' @return workspace object resulting from operation.
10+
#' @return Returns the [workspace] object passed to `x` parameter. Called primarily for side effects.
1111
#' @examples
1212
#' library(workspace)
1313
#' dir_tmp <- tempfile(pattern = "ws")
@@ -38,6 +38,7 @@
3838
#' type = "rds",
3939
#' subdir = "r-object"
4040
#' )
41+
#' @seealso [workspace] for package documentation
4142
rm_object_in_workspace <- function(x, name, type, subdir = NULL) {
4243

4344
objects_desc <- list_object_in_workspace(x)
@@ -90,7 +91,7 @@ rm_object_in_workspace <- function(x, name, type, subdir = NULL) {
9091
#' This function removes the dataset file and updates the workspace's object descriptions.
9192
#' @param x The workspace object.
9293
#' @param data_name The name of the dataset to delete from the workspace.
93-
#' @return return the workspace object
94+
#' @return Returns the [workspace] object passed to `x` parameter. Called primarily for side effects.
9495
#' @examples
9596
#' library(workspace)
9697
#' dir_tmp <- tempfile(pattern = "ws")
@@ -100,6 +101,7 @@ rm_object_in_workspace <- function(x, name, type, subdir = NULL) {
100101
#' z <- delete_dataset(x = z, data_name = "iris_dataset")
101102
#' z
102103
#' @family functions to write in a workspace
104+
#' @seealso [workspace] for package documentation
103105
delete_dataset <- function(x, data_name) {
104106

105107
base_file <- stri_trans_general(data_name, id = "latin-ascii")

R/store.R

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#' already it will be replaced. The name is translated to ascii using
2727
#' [stringi::stri_trans_general()] to avoid file naming issues.
2828
#' @param timestamp A timestamp string to associate with the entry in the workspace.
29-
#' @return Returns the workspace object passed to `x`, now containing the new dataset.
29+
#' @return Returns the [workspace] object passed to `x` parameter. Called primarily for side effects.
3030
#' @examples
3131
#' library(workspace)
3232
#' dir_tmp <- tempfile(pattern = "ws")
@@ -35,6 +35,7 @@
3535
#' z <- store_dataset(x = z, dataset = mtcars, name = "mtcars")
3636
#' z
3737
#' @family functions to write in a workspace
38+
#' @seealso [workspace] for package documentation
3839
store_dataset <- function(x, dataset, name, timestamp = format(Sys.time(), "%Y-%m-%d %H:%M:%S")) {
3940
UseMethod("store_dataset", dataset)
4041
}
@@ -124,7 +125,7 @@ store_dataset.sf <- function(x, dataset, name, timestamp = format(Sys.time(), "%
124125
#' @param name name associated with the SpatRaster, if a workspace file with this name exists
125126
#' already it will be replaced.
126127
#' @param timestamp A timestamp string to associate with the entry in the workspace.
127-
#' @return Returns the workspace object passed to `x`, now containing the new raster file.
128+
#' @return Returns the [workspace] object passed to `x` parameter. Called primarily for side effects.
128129
#' @examples
129130
#' library(workspace)
130131
#' dir_tmp <- tempfile(pattern = "ws")
@@ -136,6 +137,7 @@ store_dataset.sf <- function(x, dataset, name, timestamp = format(Sys.time(), "%
136137
#' z
137138
#' }
138139
#' @family functions to write in a workspace
140+
#' @seealso [workspace] for package documentation
139141
store_raster <- function(x, dataset, name, timestamp = format(Sys.time(), "%Y-%m-%d %H:%M:%S")) {
140142

141143
if (!requireNamespace("terra", quietly = TRUE)) {
@@ -200,7 +202,7 @@ store_dataset.SpatRaster <- function(x, dataset, name, timestamp = format(Sys.ti
200202
#' already it will be replaced.
201203
#' @param timestamp A timestamp string to associate with the entry in the workspace.
202204
#' @param subdir A subdirectory within the asset directory where the JSON file will be stored.
203-
#' @return return the workspace object
205+
#' @return Returns the [workspace] object passed to `x` parameter. Called primarily for side effects.
204206
#' @examples
205207
#' library(workspace)
206208
#' dir_tmp <- tempfile(pattern = "ws")
@@ -219,6 +221,7 @@ store_dataset.SpatRaster <- function(x, dataset, name, timestamp = format(Sys.ti
219221
#' )
220222
#' z
221223
#' @family functions to write in a workspace
224+
#' @seealso [workspace] for package documentation
222225
store_json <- function(x, json_str, filename, name = NULL, subdir, timestamp = format(Sys.time(), "%Y-%m-%d %H:%M:%S")) {
223226

224227
if (!is_string(json_str)) {
@@ -282,7 +285,7 @@ store_json <- function(x, json_str, filename, name = NULL, subdir, timestamp = f
282285
#' already it will be replaced.
283286
#' @param timestamp A timestamp string to associate with the entry in the workspace.
284287
#' @param subdir A subdirectory within the asset directory where the RDS file will be stored.
285-
#' @return return the workspace object
288+
#' @return Returns the [workspace] object passed to `x` parameter. Called primarily for side effects.
286289
#' @examples
287290
#' library(workspace)
288291
#' dir_tmp <- tempfile(pattern = "ws")
@@ -296,6 +299,7 @@ store_json <- function(x, json_str, filename, name = NULL, subdir, timestamp = f
296299
#' )
297300
#' z
298301
#' @family functions to write in a workspace
302+
#' @seealso [workspace] for package documentation
299303
store_rds <- function(x, obj, filename, name = NULL, subdir, timestamp = format(Sys.time(), "%Y-%m-%d %H:%M:%S")) {
300304

301305
if (!is_string(filename)) {
@@ -358,7 +362,7 @@ store_rds <- function(x, obj, filename, name = NULL, subdir, timestamp = format(
358362
#' already it will be replaced.
359363
#' @param timestamp A timestamp string to associate with the entry in the workspace.
360364
#' @param subdir A subdirectory within the asset directory where the YAML file will be stored.
361-
#' @return return the workspace object with new YAML file.
365+
#' @return Returns the [workspace] object passed to `x` parameter. Called primarily for side effects.
362366
#' @examples
363367
#' library(workspace)
364368
#' dir_tmp <- tempfile(pattern = "ws")
@@ -384,6 +388,7 @@ store_rds <- function(x, obj, filename, name = NULL, subdir, timestamp = format(
384388
#' )
385389
#' z
386390
#' @family functions to write in a workspace
391+
#' @seealso [workspace] for package documentation
387392
store_yaml <- function(x, list, filename, name = NULL, subdir, timestamp = format(Sys.time(), "%Y-%m-%d %H:%M:%S")) {
388393

389394
if (!inherits(list, 'list')) {

R/workspace.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ as_workspace_structure <- function(dir, obj_desc, version) {
7676
#' z <- new_workspace()
7777
#' z
7878
#' @family functions to manage workspaces
79+
#' @seealso [workspace] for package documentation
7980
new_workspace <- function(dir = tempfile(pattern = "ws")) {
8081

8182
if (dir.exists(dir)) {
@@ -132,6 +133,7 @@ new_workspace <- function(dir = tempfile(pattern = "ws")) {
132133
#' file <- tempfile(fileext = ".zip")
133134
#' pack_workspace(x = z, file = file)
134135
#' @family functions to manage workspaces
136+
#' @seealso [workspace] for package documentation
135137
pack_workspace <- function(x, file) {
136138
pack_folder(x$dir, target = file)
137139
}
@@ -175,6 +177,7 @@ pack_workspace <- function(x, file) {
175177
#' z <- unpack_workspace(file = file)
176178
#' z
177179
#' @family functions to manage workspaces
180+
#' @seealso [workspace] for package documentation
178181
unpack_workspace <- function(file) {
179182

180183
dir <- tempfile(pattern = "ws")
@@ -316,6 +319,7 @@ print.workspace <- function(x, ...) {
316319
#'
317320
#' new_z <- workspace_copy(z)
318321
#' @family functions to manage workspaces
322+
#' @seealso [workspace] for package documentation
319323
workspace_copy <- function(x) {
320324
file <- tempfile(fileext = ".zip")
321325
pack_workspace(x = x, file = file)
@@ -364,6 +368,7 @@ workspace_copy <- function(x) {
364368
#' new_x <- workspace_bind(x, z)
365369
#' new_x
366370
#' @family functions to manage workspaces
371+
#' @seealso [workspace] for package documentation
367372
workspace_bind <- function(x, y, replace = FALSE) {
368373

369374
if (!inherits(x, "workspace")) {

man/delete_dataset.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/list_object_in_workspace.Rd

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/new_workspace.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/pack_workspace.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/read_dataset_in_workspace.Rd

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)