Skip to content

Commit

Permalink
Cumulative documentation improvements (#681)
Browse files Browse the repository at this point in the history
* Fix title typo in 'tiledb_dim' and 'tiledb_attr'

* Set correct argument in returning text of 'tiledb_dim' method

Closes #678

* Consistent use of "must be" in error messages

* Capital letter for the first word in titles

* Correct description of uri param
  • Loading branch information
cgiachalis authored Mar 23, 2024
1 parent 9560ade commit 779ecdf
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 64 deletions.
8 changes: 4 additions & 4 deletions R/Array.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#' @export
tiledb_array_create <- function(uri, schema, encryption_key) {
stopifnot(`The 'uri' argument must be a string scalar` = !missing(uri) && is.scalar(uri, "character"),
`The 'schema' argument must a tiledb_array_schema object` = !missing(schema) && is(schema, "tiledb_array_schema"))
`The 'schema' argument must be a tiledb_array_schema object` = !missing(schema) && is(schema, "tiledb_array_schema"))
if (missing(encryption_key)) {
invisible(libtiledb_array_create(uri, schema@ptr))
} else {
Expand Down Expand Up @@ -82,7 +82,7 @@ tiledb_array_open <- function(arr,
##' @export
tiledb_array_open_at <- function(arr, type=c("READ","WRITE"), timestamp) {
stopifnot("The 'arr' argument must be a tiledb_array object" = .isArray(arr),
"The 'timestamp' argument must a time object" = inherits(timestamp, "POSIXct"))
"The 'timestamp' argument must be a time object" = inherits(timestamp, "POSIXct"))
type <- match.arg(type)
ctx <- tiledb_get_context()
if (.hasSlot(arr, "encryption_key") && length(arr@encryption_key) > 0) {
Expand Down Expand Up @@ -157,8 +157,8 @@ tiledb_array_is_heterogeneous <- function(arr) {
##' @export
tiledb_array_delete_fragments <- function(arr, ts_start, ts_end, ctx = tiledb_get_context()) {
stopifnot("The 'arr' argument must be a tiledb_array object" = .isArray(arr),
"The 'ts_start' argument must a time object" = inherits(ts_start, "POSIXct"),
"The 'ts_end' argument must a time object" = inherits(ts_end, "POSIXct"))
"The 'ts_start' argument must be a time object" = inherits(ts_start, "POSIXct"),
"The 'ts_end' argument must be a time object" = inherits(ts_end, "POSIXct"))
libtiledb_array_delete_fragments(ctx@ptr, arr@ptr, ts_start, ts_end)
invisible(TRUE)
}
Expand Down
4 changes: 2 additions & 2 deletions R/ArraySchema.R
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ tiledb_array_schema_get_capacity <- function(object) {
#' @export
tiledb_array_schema_set_capacity <- function(x, value) {
stopifnot(`The first argument must be a tiledb_array_schema object` = is(x, "tiledb_array_schema"),
`The second argumebt must a int or numeric value` = is.numeric(value))
`The second argumebt must be a int or numeric value` = is.numeric(value))
libtiledb_array_schema_set_capacity(x@ptr, value)
x
}
Expand Down Expand Up @@ -700,7 +700,7 @@ has_attribute <- function(schema, attr) {
#' @return A list containing two data frames, one describing the overall array as well as one
#' with descriptions about dimensions and attributes in the schema
tiledb_schema_object <- function(array) {
stopifnot(`Argument must a 'tiledb_array'` = is(array, "tiledb_array"))
stopifnot(`Argument must be a 'tiledb_array'` = is(array, "tiledb_array"))

ctx <- array@ctx
uri <- array@uri
Expand Down
2 changes: 1 addition & 1 deletion R/Attribute.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tiledb_attr.from_ptr <- function(ptr) {
new("tiledb_attr", ptr = ptr)
}

#' Contructs a `tiledb_attr` object
#' Constructs a `tiledb_attr` object
#'
#' @param name The dimension name / label string; if missing default `""` is used.
#' @param type The tiledb_attr TileDB datatype string; if missing the user is alerted
Expand Down
6 changes: 3 additions & 3 deletions R/Dim.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tiledb_dim.from_ptr <- function(ptr) {
return(new("tiledb_dim", ptr = ptr))
}

#' Contructs a `tiledb_dim` object
#' Constructs a `tiledb_dim` object
#'
#' @param name The dimension name / label string. This argument is required.
#' @param domain The dimension (inclusive) domain. The domain of a dimension
Expand Down Expand Up @@ -126,7 +126,7 @@ tiledb_dim <- function(name, domain, tile, type,
"type=\"", datatype(object), "\"",
if (nf == 0) ")" else ", ")
if (nf > 0) {
txt <- paste0(txt, "filters=", .as_text_filter_list(fl), ")")
txt <- paste0(txt, "filter_list=", .as_text_filter_list(fl), ")")
}
txt
}
Expand Down Expand Up @@ -239,7 +239,7 @@ setMethod("tiledb_ndim", "tiledb_dim",
#'
#' @export
is.anonymous.tiledb_dim <- function(object) {
stopifnot(`Argument 'object' must a tiledb_dim object` = is(object, "tiledb_dim"))
stopifnot(`Argument 'object' must be a tiledb_dim object` = is(object, "tiledb_dim"))
name <- libtiledb_dim_get_name(object@ptr)
return(nchar(name) == 0)
}
Expand Down
30 changes: 15 additions & 15 deletions R/FragmentInfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ tiledb_fragment_info <- function(uri, ctx = tiledb_get_context()) {
#' @return A character variable with URI
#' @export
tiledb_fragment_info_uri <- function(object, fid) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid))
libtiledb_fragment_info_uri(object@ptr, fid)
}
Expand All @@ -70,7 +70,7 @@ tiledb_fragment_info_uri <- function(object, fid) {
#' @return A TileDB Domain object
#' @export
tiledb_fragment_info_get_non_empty_domain_index <- function(object, fid, did, typestr) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid),
`Argument did must be a numeric` = is.numeric(did))
if (missing(typestr)) {
Expand Down Expand Up @@ -98,7 +98,7 @@ tiledb_fragment_info_get_non_empty_domain_index <- function(object, fid, did, ty
#' @return A TileDB Domain object
#' @export
tiledb_fragment_info_get_non_empty_domain_name <- function(object, fid, dim_name, typestr) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid),
`Argument dim_name must be a scalar character` = is.scalar(dim_name, "character"))
if (missing(typestr)) {
Expand All @@ -124,7 +124,7 @@ tiledb_fragment_info_get_non_empty_domain_name <- function(object, fid, dim_name
#' @return A character vector with two elements
#' @export
tiledb_fragment_info_get_non_empty_domain_var_index <- function(object, fid, did) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid),
`Argument did must be a numeric` = is.numeric(did))
libtiledb_fragment_info_get_non_empty_domain_var_index(object@ptr, fid, did)
Expand All @@ -138,7 +138,7 @@ tiledb_fragment_info_get_non_empty_domain_var_index <- function(object, fid, did
#' @return A character vector with two elements
#' @export
tiledb_fragment_info_get_non_empty_domain_var_name <- function(object, fid, dim_name) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid),
`Argument dim_name must be a scalar character` = is.scalar(dim_name, "character"))
libtiledb_fragment_info_get_non_empty_domain_var_name(object@ptr, fid, dim_name)
Expand All @@ -150,7 +150,7 @@ tiledb_fragment_info_get_non_empty_domain_var_name <- function(object, fid, dim_
#' @return A numeric variable with the number of fragments
#' @export
tiledb_fragment_info_get_num <- function(object) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"))
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"))
libtiledb_fragment_info_num(object@ptr)
}

Expand All @@ -161,7 +161,7 @@ tiledb_fragment_info_get_num <- function(object) {
#' @return A numeric variable with the number of fragments
#' @export
tiledb_fragment_info_get_size <- function(object, fid) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid))
libtiledb_fragment_info_size(object@ptr, fid)
}
Expand All @@ -173,7 +173,7 @@ tiledb_fragment_info_get_size <- function(object, fid) {
#' @return A logical value indicating if the fragment is dense
#' @export
tiledb_fragment_info_dense <- function(object, fid) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid))
libtiledb_fragment_info_dense(object@ptr, fid)
}
Expand All @@ -185,7 +185,7 @@ tiledb_fragment_info_dense <- function(object, fid) {
#' @return A logical value indicating if the fragment is sparse
#' @export
tiledb_fragment_info_sparse <- function(object, fid) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid))
libtiledb_fragment_info_sparse(object@ptr, fid)
}
Expand All @@ -207,7 +207,7 @@ tiledb_fragment_info_get_timestamp_range <- function(object, fid) {
#' @return A numeric value with the number of cells
#' @export
tiledb_fragment_info_get_cell_num <- function(object, fid) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid))
libtiledb_fragment_info_cell_num(object@ptr, fid)
}
Expand All @@ -229,7 +229,7 @@ tiledb_fragment_info_get_version <- function(object, fid) {
#' @return A logical value indicating consolidated metadata
#' @export
tiledb_fragment_info_has_consolidated_metadata <- function(object, fid) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid))
libtiledb_fragment_info_has_consolidated_metadata(object@ptr, fid)
}
Expand All @@ -240,7 +240,7 @@ tiledb_fragment_info_has_consolidated_metadata <- function(object, fid) {
#' @return A numeric value with the number of unconsolidated metadata
#' @export
tiledb_fragment_info_get_unconsolidated_metadata_num <- function(object) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"))
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"))
libtiledb_fragment_info_unconsolidated_metadata_num(object@ptr)
}

Expand All @@ -250,7 +250,7 @@ tiledb_fragment_info_get_unconsolidated_metadata_num <- function(object) {
#' @return A numeric value with the number of to be vacuumed fragments
#' @export
tiledb_fragment_info_get_to_vacuum_num <- function(object) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"))
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"))
libtiledb_fragment_info_to_vacuum_num(object@ptr)
}

Expand All @@ -261,7 +261,7 @@ tiledb_fragment_info_get_to_vacuum_num <- function(object) {
#' @return A character variable with the URI of the be vacuumed index
#' @export
tiledb_fragment_info_get_to_vacuum_uri <- function(object, fid) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"),
`Argument fid must be a numeric` = is.numeric(fid))
libtiledb_fragment_info_to_vacuum_uri(object@ptr, fid)
}
Expand All @@ -272,6 +272,6 @@ tiledb_fragment_info_get_to_vacuum_uri <- function(object, fid) {
#' @return Nothing is returned, as a side effect the fragment info is displayed
#' @export
tiledb_fragment_info_dump <- function(object) {
stopifnot(`Argument object mustbe a tiledb_fragment_info` = is(object, "tiledb_fragment_info"))
stopifnot(`Argument object must be a tiledb_fragment_info` = is(object, "tiledb_fragment_info"))
libtiledb_fragment_info_dump(object@ptr)
}
12 changes: 6 additions & 6 deletions R/Object.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#'
#' @export
tiledb_object_type <- function(uri, ctx = tiledb_get_context()) {
stopifnot("The 'ctx' argument must a tiledb_ctx" = is(ctx, "tiledb_ctx"),
stopifnot("The 'ctx' argument must be a tiledb_ctx" = is(ctx, "tiledb_ctx"),
"The 'uri' argument must be a string scalar" =
!missing(uri) && is.scalar(uri,"character"))
libtiledb_object_type(ctx@ptr, uri)
Expand All @@ -43,12 +43,12 @@ tiledb_object_type <- function(uri, ctx = tiledb_get_context()) {
#'
#' Raises an error if the uri is invalid, or the uri resource is not a tiledb object
#'
#' @param uri path which to create group
#' @param uri path to TileDB resource
#' @param ctx tiledb_ctx object (optional)
#' @return uri of removed TileDB resource
#' @export
tiledb_object_rm <- function(uri, ctx = tiledb_get_context()) {
stopifnot("The 'ctx' argument must a tiledb_ctx" = is(ctx, "tiledb_ctx"),
stopifnot("The 'ctx' argument must be a tiledb_ctx" = is(ctx, "tiledb_ctx"),
"The 'uri' argument must be a string scalar" =
!missing(uri) && is.scalar(uri,"character"))
libtiledb_object_remove(ctx@ptr, uri)
Expand All @@ -64,7 +64,7 @@ tiledb_object_rm <- function(uri, ctx = tiledb_get_context()) {
#' @return new uri of moved tiledb resource
#' @export
tiledb_object_mv <- function(old_uri, new_uri, ctx = tiledb_get_context()) {
stopifnot("The 'ctx' argument must a tiledb_ctx" = is(ctx, "tiledb_ctx"),
stopifnot("The 'ctx' argument must be a tiledb_ctx" = is(ctx, "tiledb_ctx"),
"The 'old_uri' argument must be a string scalar" = !missing(old_uri) && is.scalar(old_uri,"character"),
"The 'new_uri' argument must be a string scalar" = !missing(new_uri) && is.scalar(new_uri,"character"))
libtiledb_object_move(ctx@ptr, old_uri, new_uri)
Expand All @@ -78,7 +78,7 @@ tiledb_object_mv <- function(old_uri, new_uri, ctx = tiledb_get_context()) {
#' @return a dataframe with object type, object uri string columns
#' @export
tiledb_object_ls <- function(uri, filter = NULL, ctx = tiledb_get_context()) {
stopifnot("The 'ctx' argument must a tiledb_ctx" = is(ctx, "tiledb_ctx"),
stopifnot("The 'ctx' argument must be a tiledb_ctx" = is(ctx, "tiledb_ctx"),
"The 'uri' argument must be a string scalar" =
!missing(uri) && is.scalar(uri,"character"))
libtiledb_object_walk(ctx@ptr, uri, order = "PREORDER")
Expand All @@ -93,7 +93,7 @@ tiledb_object_ls <- function(uri, filter = NULL, ctx = tiledb_get_context()) {
#' @export
tiledb_object_walk <- function(uri, order = c("PREORDER", "POSTORDER"), ctx = tiledb_get_context()) {
order <- match.arg(order)
stopifnot("The 'ctx' argument must a tiledb_ctx" = is(ctx, "tiledb_ctx"),
stopifnot("The 'ctx' argument must be a tiledb_ctx" = is(ctx, "tiledb_ctx"),
"The 'order' argument must be a string scalar" = is.scalar(order,"character"),
"The 'uri' argument must be a string scalar" =
!missing(uri) && is.scalar(uri,"character"))
Expand Down
2 changes: 1 addition & 1 deletion R/QueryCondition.R
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ tiledb_query_condition_set_use_enumeration <- function(qc, use_enum, ctx = tiled
libtiledb_query_condition_set_use_enumeration(ctx@ptr, qc@ptr, use_enum)
}

#' create a query condition for vector 'IN' and 'NOT_IN' operations
#' Create a query condition for vector 'IN' and 'NOT_IN' operations
#'
#' Uses \sQuote{IN} and \sQuote{NOT_IN} operators on given attribute
#' @param name A character value with the scheme attribute name
Expand Down
Loading

0 comments on commit 779ecdf

Please sign in to comment.