Skip to content

Commit b85270e

Browse files
committed
Move match.arg() check on the top
closes #779
1 parent 576c045 commit b85270e

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

R/Group.R

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ setClass("tiledb_group",
3333
#' Creates a 'tiledb_group' object
3434
#'
3535
#' @param uri Character variable with the URI of the new group object
36-
#' @param type Character variable with the query type value: one of
36+
#' @param type Character variable with the query type value: one of
3737
#' \dQuote{READ} or \dQuote{WRITE}
3838
#' @param ctx (optional) A TileDB Context object; if not supplied the default
3939
#' context object is retrieved
4040
#' @param cfg (optional) A TileConfig object
4141
#' @return A 'group' object
4242
#' @export
4343
tiledb_group <- function(
44-
uri,
44+
uri,
4545
type = c("READ", "WRITE"),
46-
ctx = tiledb_get_context(),
46+
ctx = tiledb_get_context(),
4747
cfg = NULL
4848
) {
4949
stopifnot(
@@ -65,30 +65,30 @@ tiledb_group <- function(
6565

6666
##' Open a TileDB Group
6767
##'
68-
##' @param grp A TileDB Group object as for example returned by
68+
##' @param grp A TileDB Group object as for example returned by
6969
##' \code{tiledb_group()}
70-
##' @param type A character value that must be either \sQuote{READ},
70+
##' @param type A character value that must be either \sQuote{READ},
7171
##' \sQuote{WRITE} or \sQuote{MODIFY_EXCLUSIVE}
7272
##' @return The TileDB Group object but opened for reading or writing
7373
##' @export
7474
tiledb_group_open <- function(
75-
grp,
75+
grp,
7676
type = c("READ", "WRITE", "MODIFY_EXCLUSIVE")
7777
) {
78+
type <- match.arg(type)
7879
stopifnot(
7980
"The 'grp' argument must be a tiledb_group object" = is(grp, "tiledb_group"),
8081
"This function needs TileDB 2.8.*" = .tiledb28(),
8182
"Using 'MODIFY_EXCLUSIVE' needs TileDB 2.12.* or later" =
8283
type != "MODIFY_EXCLUSIVE" || tiledb_version(TRUE) >= "2.12.0"
8384
)
84-
type <- match.arg(type)
8585
grp@ptr <- libtiledb_group_open(grp@ptr, type)
8686
grp
8787
}
8888

8989
##' Set a TileDB Config for a TileDB Group
9090
##'
91-
##' @param grp A TileDB Group object as for example returned by
91+
##' @param grp A TileDB Group object as for example returned by
9292
##' \code{tiledb_group()}
9393
##' @param cfg A TileDB Config object
9494
##' @return The TileDB Group object with added Config
@@ -105,7 +105,7 @@ tiledb_group_set_config <- function(grp, cfg) {
105105

106106
##' Get a TileDB Config from a TileDB Group
107107
##'
108-
##' @param grp A TileDB Group object as for example returned by
108+
##' @param grp A TileDB Group object as for example returned by
109109
##' \code{tiledb_group()}
110110
##' @return The TileDB Config object of the TileDB Group object
111111
##' @export
@@ -121,7 +121,7 @@ tiledb_group_get_config <- function(grp) {
121121

122122
##' Close a TileDB Group
123123
##'
124-
##' @param grp A TileDB Group object as for example returned by
124+
##' @param grp A TileDB Group object as for example returned by
125125
##' \code{tiledb_group()}
126126
##' @return The TileDB Group object but closed for reading or writing
127127
##' @export
@@ -162,7 +162,7 @@ tiledb_group_create <- function(uri, ctx = tiledb_get_context()) {
162162

163163
##' Test if TileDB Group is open
164164
##'
165-
##' @param grp A TileDB Group object as for example returned by
165+
##' @param grp A TileDB Group object as for example returned by
166166
##' \code{tiledb_group()}
167167
##' @return A boolean indicating whether the TileDB Group object is open
168168
##' @export
@@ -176,7 +176,7 @@ tiledb_group_is_open <- function(grp) {
176176

177177
##' Return a TileDB Group URI
178178
##'
179-
##' @param grp A TileDB Group object as for example returned by
179+
##' @param grp A TileDB Group object as for example returned by
180180
##' \code{tiledb_group()}
181181
##' @return A character value with the URI
182182
##' @export
@@ -190,9 +190,9 @@ tiledb_group_uri <- function(grp) {
190190

191191
##' Return a TileDB Group query type
192192
##'
193-
##' @param grp A TileDB Group object as for example returned by
193+
##' @param grp A TileDB Group object as for example returned by
194194
##' \code{tiledb_group()}
195-
##' @return A character value with the query type i.e. one of
195+
##' @return A character value with the query type i.e. one of
196196
##' \dQuote{READ} or \dQuote{WRITE}.
197197
##' @export
198198
tiledb_group_query_type <- function(grp) {
@@ -205,9 +205,9 @@ tiledb_group_query_type <- function(grp) {
205205

206206
##' Write Metadata to a TileDB Group
207207
##'
208-
##' @param grp A TileDB Group object as for example returned by
208+
##' @param grp A TileDB Group object as for example returned by
209209
##' \code{tiledb_group()}
210-
##' @param key A character value with they index under which the
210+
##' @param key A character value with they index under which the
211211
##' data will be written
212212
##' @param val An R object (numeric, int, or char vector) that will be stored
213213
##' @return On success boolean \sQuote{TRUE} is returned
@@ -223,9 +223,9 @@ tiledb_group_put_metadata <- function(grp, key, val) {
223223

224224
##' Deletes Metadata from a TileDB Group
225225
##'
226-
##' @param grp A TileDB Group object as for example returned by
226+
##' @param grp A TileDB Group object as for example returned by
227227
##' \code{tiledb_group()}
228-
##' @param key A character value with they index under which the
228+
##' @param key A character value with they index under which the
229229
##' data will be written
230230
##' @return The TileDB Group object, invisibly
231231
##' @export
@@ -241,9 +241,9 @@ tiledb_group_delete_metadata <- function(grp, key) {
241241

242242
##' Accesses Metadata from a TileDB Group
243243
##'
244-
##' @param grp A TileDB Group object as for example returned by
244+
##' @param grp A TileDB Group object as for example returned by
245245
##' \code{tiledb_group()}
246-
##' @param key A character value with the key of the metadata
246+
##' @param key A character value with the key of the metadata
247247
##' object to be retrieved
248248
##' @return The requested object, or NULL is not found
249249
##' @export
@@ -258,9 +258,9 @@ tiledb_group_get_metadata <- function(grp, key) {
258258

259259
##' Checks for Metadata in a TileDB Group
260260
##'
261-
##' @param grp A TileDB Group object as for example returned by
261+
##' @param grp A TileDB Group object as for example returned by
262262
##' \code{tiledb_group()}
263-
##' @param key A character value with they index under which the
263+
##' @param key A character value with they index under which the
264264
##' data will be written
265265
##' @return A boolean value indicating with the object is present
266266
##' @export
@@ -275,7 +275,7 @@ tiledb_group_has_metadata <- function(grp, key) {
275275

276276
##' Returns Number of Metadata Objects a TileDB Group
277277
##'
278-
##' @param grp A TileDB Group object as for example returned by
278+
##' @param grp A TileDB Group object as for example returned by
279279
##' \code{tiledb_group()}
280280
##' @return A numeric value with the number of metadata objects
281281
##' @export
@@ -290,7 +290,7 @@ tiledb_group_metadata_num <- function(grp) {
290290

291291
##' Accesses Metadata by Index from a TileDB Group
292292
##'
293-
##' @param grp A TileDB Group object as for example returned by
293+
##' @param grp A TileDB Group object as for example returned by
294294
##' \code{tiledb_group()}
295295
##' @param idx A numeric value with the index of the metadata object to be retrieved
296296
##' @return The requested object, or NULL is not found
@@ -307,7 +307,7 @@ tiledb_group_get_metadata_from_index <- function(grp, idx) {
307307

308308
##' Return all Metadata from a TileDB Group
309309
##'
310-
##' @param grp A TileDB Group object as for example returned by
310+
##' @param grp A TileDB Group object as for example returned by
311311
##' \code{tiledb_group()}
312312
##' @return A named List with all Metadata objects index
313313
##' @export
@@ -329,12 +329,12 @@ tiledb_group_get_all_metadata <- function(grp) {
329329

330330
##' Add Member to TileDB Group
331331
##'
332-
##' @param grp A TileDB Group object as for example returned by
332+
##' @param grp A TileDB Group object as for example returned by
333333
##' \code{tiledb_group()}
334334
##' @param uri A character value with a new URI
335-
##' @param relative A logical value indicating whether URI is
335+
##' @param relative A logical value indicating whether URI is
336336
##' relative to the group
337-
##' @param name An optional character providing a name for the
337+
##' @param name An optional character providing a name for the
338338
##' object, defaults to \code{NULL}
339339
##' @return The TileDB Group object, invisibly
340340
##' @export
@@ -352,9 +352,9 @@ tiledb_group_add_member <- function(grp, uri, relative, name = NULL) {
352352

353353
##' Remove Member from TileDB Group
354354
##'
355-
##' @param grp A TileDB Group object as for example returned by
355+
##' @param grp A TileDB Group object as for example returned by
356356
##' \code{tiledb_group()}
357-
##' @param uri A character value with a the URI of the member to
357+
##' @param uri A character value with a the URI of the member to
358358
##' be removed, or (if added with a name) the name of the member
359359
##' @return The TileDB Group object, invisibly
360360
##' @export
@@ -370,7 +370,7 @@ tiledb_group_remove_member <- function(grp, uri) {
370370

371371
##' Get Member Count from TileDB Group
372372
##'
373-
##' @param grp A TileDB Group object as for example returned by
373+
##' @param grp A TileDB Group object as for example returned by
374374
##' \code{tiledb_group()}
375375
##' @return The Count of Members in the TileDB Group object
376376
##' @export
@@ -384,14 +384,14 @@ tiledb_group_member_count <- function(grp) {
384384

385385
##' Get a Member (Description) by Index from TileDB Group
386386
##'
387-
##' This function returns a three-element character vector with the member
387+
##' This function returns a three-element character vector with the member
388388
##' object translated to character, uri, and optional name.
389389
##'
390-
##' @param grp A TileDB Group object as for example returned by
390+
##' @param grp A TileDB Group object as for example returned by
391391
##' \code{tiledb_group()}
392-
##' @param idx A numeric value with the index of the metadata
392+
##' @param idx A numeric value with the index of the metadata
393393
##' object to be retrieved
394-
##' @return A character vector with three elements: the member
394+
##' @return A character vector with three elements: the member
395395
##' type, its uri, and name (or \code{""} if the member is unnamed).
396396
##' @export
397397
tiledb_group_member <- function(grp, idx) {
@@ -405,10 +405,10 @@ tiledb_group_member <- function(grp, idx) {
405405

406406
##' Dump the TileDB Group to String
407407
##'
408-
##' @param grp A TileDB Group object as for example returned by
408+
##' @param grp A TileDB Group object as for example returned by
409409
##' \code{tiledb_group()}
410-
##' @param recursive A logical value indicating whether a recursive
411-
##' dump is desired, defaults to \sQuote{FALSE}. Note that recursive listings
410+
##' @param recursive A logical value indicating whether a recursive
411+
##' dump is desired, defaults to \sQuote{FALSE}. Note that recursive listings
412412
##' on remote object may be an expensive or slow operation.
413413
##' @return A character string
414414
##' @export
@@ -422,7 +422,7 @@ tiledb_group_member_dump <- function(grp, recursive = FALSE) {
422422

423423
##' Test if a Named Group is Using a Relative URI
424424
##'
425-
##' @param grp A TileDB Group object as for example returned by
425+
##' @param grp A TileDB Group object as for example returned by
426426
##' \code{tiledb_group()}
427427
##' @param name A character value with a group name
428428
##' @return A boolean indicating whether the group uses a relative URI or not
@@ -447,10 +447,10 @@ setMethod("show", signature(object = "tiledb_group"), function(object) {
447447

448448
#' Deletes all written data from a 'tiledb_group' object
449449
#'
450-
#' The group must be opened in \sQuote{MODIFY_EXCLUSIVE} mode, otherwise
450+
#' The group must be opened in \sQuote{MODIFY_EXCLUSIVE} mode, otherwise
451451
#' the function will error out.
452452
#'
453-
#' @param grp A TileDB Group object as for example returned by
453+
#' @param grp A TileDB Group object as for example returned by
454454
#' \code{tiledb_group()}
455455
#' @param uri Character variable with the URI of the group item to be deleted
456456
#' @param recursive A logical value indicating whether all data inside the

0 commit comments

Comments
 (0)