Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
80f7864
sets up use of cnd (#259)
jmbarbone Sep 22, 2025
087f463
includes walrus operator (#259)
jmbarbone Sep 22, 2025
caec09f
updates conditions for append (#259)
jmbarbone Sep 22, 2025
8c49c71
updates conditions for array (#259)
jmbarbone Sep 22, 2025
26a168f
updates conditions for base-conversion (#259)
jmbarbone Sep 22, 2025
f88b7fa
updates conditions for bib (#259)
jmbarbone Sep 22, 2025
a5e05a5
updates conditions for char2fact (#259)
jmbarbone Sep 22, 2025
1c099a7
updates conditions for dataframes
jmbarbone Sep 22, 2025
5deb784
updates conditions for dates (#259)
jmbarbone Sep 22, 2025
81f876d
updates conditions for description (#259)
jmbarbone Sep 22, 2025
5c7c1f8
updates conditions for detail (#259)
jmbarbone Sep 22, 2025
98f2f70
cleans up list merging and na objects (#259)
jmbarbone Sep 22, 2025
9d91a58
redocs (#259)
jmbarbone Sep 22, 2025
8d8ea37
updates conditions for diff-time (#259)
jmbarbone Sep 22, 2025
a7cdb96
draft of news update (#259)
jmbarbone Sep 22, 2025
57a43e6
updates conditions for directory (#259)
jmbarbone Sep 23, 2025
be68e09
updates conditions for expand (#259)
jmbarbone Sep 23, 2025
fbe2c43
Update mark.Rproj (#259)
jmbarbone Sep 23, 2025
5132ebf
updates conditions for fct-expand-seq (#259)
jmbarbone Sep 23, 2025
2a1f557
renames file (#259)
jmbarbone Sep 23, 2025
bc79538
corrects space (#259)
jmbarbone Sep 27, 2025
72cf172
formatting (#259)
jmbarbone Sep 27, 2025
2c10be3
adds condition for files (#259)
jmbarbone Sep 27, 2025
776bfe9
adds conditions for identical (#259)
jmbarbone Sep 27, 2025
b79b809
adds condition for import (#259)
jmbarbone Sep 27, 2025
46dcbf6
updates difftime test (#259)
jmbarbone Sep 29, 2025
af1c731
updates inserts conditions (#259)
jmbarbone Sep 29, 2025
9db2be6
updates tests for identical (#259)
jmbarbone Sep 29, 2025
6198467
updates conditions for files and writes (#259)
jmbarbone Sep 29, 2025
2f9e2c9
updates min versions (#259)
jmbarbone Sep 29, 2025
c07b49b
adds export (#259)
jmbarbone Sep 29, 2025
abc0d05
updates conditions for labels (#259)
jmbarbone Sep 29, 2025
ec942e6
cleanup (#259)
jmbarbone Oct 12, 2025
ec93433
updates conditions for logic (#259)
jmbarbone Nov 15, 2025
2997c88
updates conditions for percentile rank (#259)
jmbarbone Nov 15, 2025
deaf15b
updates conditions for recode (#259)
jmbarbone Nov 24, 2025
534a3bf
updates conditions for row-bind (#259)
jmbarbone Nov 24, 2025
54f54aa
updates conditions for match-arg (#259)
jmbarbone Nov 25, 2025
bf6815c
corrects returns (#259)
jmbarbone Nov 25, 2025
59f825b
updates na-assignment conditions (#259)
jmbarbone Nov 25, 2025
004b8e4
adds note in NEWS (#259)
jmbarbone Nov 25, 2025
a2d7338
updates conditions for not-available (#259)
jmbarbone Nov 26, 2025
c8e64a2
corrects name (#259)
jmbarbone Nov 26, 2025
694aeb1
updates conditions for note (#259)
jmbarbone Nov 26, 2025
6f77b13
clean up clip helpers in testing (#259)
jmbarbone Nov 26, 2025
566ead5
update conditions for options (#259)
jmbarbone Nov 27, 2025
128dfac
updates conditions for paste (#259)
jmbarbone Nov 27, 2025
b96c255
update condition for sort-by (#259)
jmbarbone Nov 28, 2025
138e4c8
updates conditions for within (#259)
jmbarbone Nov 28, 2025
bffaa05
typos (#259)
jmbarbone Nov 28, 2025
593d876
updates tests (#259)
jmbarbone Nov 28, 2025
d8acdf0
updates conditions for sourcing (#259)
jmbarbone Nov 30, 2025
b77cd2b
updates condition for utils (#259)
jmbarbone Nov 30, 2025
b2c66e1
updates conditions for todos (#259)
jmbarbone Nov 30, 2025
6151c1e
updates conditions for switch (#259)
jmbarbone Nov 30, 2025
1c49db2
adds generic package errors (#259)
jmbarbone Dec 8, 2025
e3e710b
replaces array condition with input error (#259)
jmbarbone Dec 8, 2025
a44f0f5
uses single base conversion error (#259)
jmbarbone Dec 8, 2025
4372b47
uses single bib error (#259)
jmbarbone Dec 8, 2025
2736d45
uses internal errors for switches (#259)
jmbarbone Dec 8, 2025
3d40365
makes array_extract() deprecated (#259)
jmbarbone Dec 27, 2025
51512aa
removes linting, testing, coverage from array and time report (#259)
jmbarbone Dec 27, 2025
cf8f296
updates bib errors (#259)
jmbarbone Dec 27, 2025
20f72ff
suppresses outputs (#259)
jmbarbone Dec 27, 2025
c464d41
updates errors (#259)
jmbarbone Dec 27, 2025
46ee258
simplies capply() (#259)
jmbarbone Dec 27, 2025
853de18
adds header (#259)
jmbarbone Dec 28, 2025
d56fe13
updates generic package errors (#259)
jmbarbone Dec 28, 2025
ed31534
uses generic conditions more; simplifies condition names
jmbarbone Dec 28, 2025
34d1427
ignores air.toml (#259)
jmbarbone Dec 30, 2025
c3fd3d1
formatting (#259)
jmbarbone Dec 30, 2025
10e0cd8
adds note (#259)
jmbarbone Dec 30, 2025
1f99cb3
uses substitute for make_do_ls function generator (#259)
jmbarbone Dec 30, 2025
7248ada
updates conditions (#259)
jmbarbone Dec 30, 2025
8098917
formatting (#259)
jmbarbone Dec 30, 2025
42bb946
updates conditions (#259)
jmbarbone Dec 30, 2025
242b5a2
reformats class error default text (#259)
jmbarbone Dec 31, 2025
976b59c
improves conversion errors (#259)
jmbarbone Dec 31, 2025
a184982
improves blank errors (#259)
jmbarbone Dec 31, 2025
9e09a4f
improves fact2char errors (#259)
jmbarbone Dec 31, 2025
4c5115a
improves counts errors (#259)
jmbarbone Dec 31, 2025
df2f72d
formatting (#259)
jmbarbone Dec 31, 2025
f78d8cc
improves insert errors (#259)
jmbarbone Dec 31, 2025
de4a1dd
cleans up base conversions conditions (#259)
jmbarbone Dec 31, 2025
a4ca36f
corrects test (#259)
jmbarbone Dec 31, 2025
65b5926
corrects name (#259)
jmbarbone Dec 31, 2025
7e44ea7
uses general error (#259)
jmbarbone Dec 31, 2025
9baa692
formatting (#259)
jmbarbone Dec 31, 2025
c284025
updates conditions for limit (#259)
jmbarbone Dec 31, 2025
48453d6
updates tests (#259)
jmbarbone Dec 31, 2025
df21718
clean up match param errors (#259)
jmbarbone Jan 2, 2026
7b614a1
uses new error (#259)
jmbarbone Jan 2, 2026
835d899
updates tests (#259)
jmbarbone Jan 2, 2026
9a17333
clean up map (#259)
jmbarbone Jan 3, 2026
0732a00
skip formatting (#259)
jmbarbone Jan 3, 2026
11c1b0e
updates conditions for merge-list (#259)
jmbarbone Jan 3, 2026
ec7dafe
simplifies na errors (#259)
jmbarbone Jan 3, 2026
fd5f657
updates test (#259)
jmbarbone Jan 3, 2026
be61255
adds internal error (#259)
jmbarbone Jan 3, 2026
567f712
simplifies na-assignment errors (#259)
jmbarbone Jan 4, 2026
f4510c2
replaces stopifnot() for normalize() (#259)
jmbarbone Jan 4, 2026
28c2439
suppresses deprecated warnings (#259)
jmbarbone Jan 4, 2026
b7b19e1
updates checks in merge_list() (#259)
jmbarbone Jan 4, 2026
d697ead
updates conditions for not-available (#259)
jmbarbone Jan 4, 2026
a6e3ff8
updates note error (#259)
jmbarbone Jan 4, 2026
33d40e9
updates options conditions (#259)
jmbarbone Jan 4, 2026
1abe6a2
updates paste conditions (#259)
jmbarbone Jan 4, 2026
e70774f
updates percentile rank error (#259)
jmbarbone Jan 4, 2026
15d7162
updates recode errors (#259)
jmbarbone Jan 4, 2026
eb65168
updates error in row-bind (#259)
jmbarbone Jan 4, 2026
610fe9b
updates sort error (#259)
jmbarbone Jan 4, 2026
023641e
updates sourcing errors (#259)
jmbarbone Jan 4, 2026
a3f433d
updates errors in todos (#259)
jmbarbone Jan 4, 2026
db70f52
simplifies is_atomic0() for R version 4.4 (#259)
jmbarbone Jan 5, 2026
0014de9
replaces vector_required error with input_error (#259)
jmbarbone Jan 5, 2026
edc1189
typo for options error (#259)
jmbarbone Jan 5, 2026
31b235d
simplifies within errors (#259)
jmbarbone Jan 5, 2026
21eebd7
simplifies write errors (#259)
jmbarbone Jan 5, 2026
c30e283
formatting (#259)
jmbarbone Jan 5, 2026
2b084e3
includes warnings (#259)
jmbarbone Jan 5, 2026
db92242
improves check_is_vector() error (#259)
jmbarbone Jan 5, 2026
6dca3c5
formatting (#259)
jmbarbone Jan 5, 2026
9c07a1a
updates tests (#259)
jmbarbone Jan 5, 2026
3171fd3
redocs (#259)
jmbarbone Jan 5, 2026
1d3d1e0
set parallel ncpus (#259)
jmbarbone Jan 7, 2026
0873358
updates class_error, type_error (#259)
jmbarbone Jan 7, 2026
f037ea7
updates bib errors (#259)
jmbarbone Jan 7, 2026
80714fa
replaces stopifnot() (#259)
jmbarbone Jan 7, 2026
b4c948d
formatting (#259)
jmbarbone Jan 7, 2026
718a8a1
corrects for current name conflicts (#259)
jmbarbone Jan 8, 2026
736d284
updates tests (#259)
jmbarbone Jan 8, 2026
3c2987f
redocs (#259)
jmbarbone Jan 8, 2026
7b31ee3
updates R version (#259)
jmbarbone Jan 8, 2026
6a66248
adds todo notes (#259)
jmbarbone Feb 11, 2026
3786659
adds exports and type (#259)
jmbarbone Feb 11, 2026
8de5dc8
removes unused condition (#259)
jmbarbone Feb 11, 2026
9593878
documents tests (#259)
jmbarbone Feb 11, 2026
88d042e
bumps cnd versino (#259)
jmbarbone Feb 16, 2026
2608b60
Merge branch 'main' into 259-cnd
jmbarbone Feb 21, 2026
c1f8ef5
redocs (#259)
jmbarbone Feb 21, 2026
875d022
uses default cnd conditions (#259)
jmbarbone Feb 23, 2026
775cccd
redocs (#259)
jmbarbone Feb 23, 2026
c270d16
updates tests (#259)
jmbarbone Feb 23, 2026
e960466
delints (#259)
jmbarbone Feb 24, 2026
1107f75
adds additional classes to conditions (#259)
jmbarbone Feb 25, 2026
f59ede4
renames and removes some conditions (#259)
jmbarbone Feb 25, 2026
4eb6f54
corrects condition classes (#259)
jmbarbone Feb 28, 2026
0c5b4fa
updates match errors (#259)
jmbarbone Feb 28, 2026
cc4c73e
removes unused conditions (#259)
jmbarbone Feb 28, 2026
ae58ead
updates md5 condition (#259)
jmbarbone Feb 28, 2026
62fb704
adds classes (#259)
jmbarbone Mar 5, 2026
5a46bcb
simplifies errors (#259)
jmbarbone Mar 5, 2026
08c267d
redocs (#259)
jmbarbone Mar 5, 2026
fddd5af
updates tests (#259)
jmbarbone Mar 5, 2026
994234a
adds lint skips (#259)
jmbarbone Mar 30, 2026
68bb9e0
removes unused formatting (#259)
jmbarbone Mar 30, 2026
6a58745
bumps fuj, cnd; replaced quick_dfl() (#259)
jmbarbone Mar 30, 2026
c8926cd
updates tests (#259)
jmbarbone Mar 30, 2026
2ede42c
correct dataframe() usage (#259)
jmbarbone Mar 31, 2026
5c38f07
redocs (#259)
jmbarbone Mar 31, 2026
b432e83
removes extra hooks (#259)
jmbarbone Apr 11, 2026
a6f0836
updates hook (#259)
jmbarbone Apr 11, 2026
c470aaf
redocs (#259)
jmbarbone Apr 13, 2026
e6e139a
Update DESCRIPTION (#259)
jmbarbone Apr 13, 2026
526d192
typo (#259)
jmbarbone Apr 13, 2026
5dff59a
redocs (#259)
jmbarbone Apr 18, 2026
f362a5d
version bump (#259)
jmbarbone Apr 18, 2026
cc21d56
formatting (#259)
jmbarbone Apr 19, 2026
389b7e0
redocs (#259)
jmbarbone Apr 19, 2026
33a2380
attach testthat for helpers (#259)
jmbarbone Apr 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ revdep
^CRAN-SUBMISSION$
^\.lintr$
^\.git$
^air\.toml$
1 change: 1 addition & 0 deletions .Renviron
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ _R_CHECK_RD_EXAMPLES_T_AND_F_=TRUE
_R_CHECK_INSTALL_DEPENDS_=TRUE
_R_CHECK_DEPRECATED_DEFUNCT_=TRUE
_R_CHECK_DONTTEST_EXAMPLES_=TRUE
TESTTHAT_CPUS=4
4 changes: 0 additions & 4 deletions .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ if (file.exists(".Renviron")) {
readRenviron(".Renviron")
}

# Don't need anymore
Sys.setenv(TESTTHAT_CPUS = 4)
options(Ncpus = 4)

# Some issue where this was failing in tests
Sys.setenv(TESTTHAT_PARALLEL = if (getRversion() < "4") "FALSE" else "TRUE")

Expand Down
5 changes: 4 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ linters: linters_with_defaults(
)
encoding: "UTF-8"
exclusions: list(
"tests/spelling.R"
"tests/spelling.R",
"R/array.R",
"R/time-report.R",
"R/mark-cnd-conditions.R"
)
20 changes: 14 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mark
Type: Package
Title: Multipurpose Aids for R Kit
Version: 0.8.3.9007
Version: 0.8.3.9008
Authors@R:
person(given = "Jordan Mark",
family = "Barbone",
Expand All @@ -20,17 +20,19 @@ BugReports: https://github.com/jmbarbone/mark/issues
Encoding: UTF-8
LazyData: true
Depends:
R (>= 3.6)
R (>= 4.1.0)
Imports:
cli,
fs (>= 1.6.2),
fuj (>= 0.2.1),
cnd,
fs (>= 0.2.0),
fuj,
magrittr (>= 2.0.1),
rlang,
stats (>= 3.6),
tools (>= 3.6),
utils (>= 3.6)
Suggests:
arrow (>= 16.1.0),
bench (>= 1.1.1),
bib2df (>= 1.1.1),
clipr (>= 0.8.0),
Expand All @@ -53,11 +55,15 @@ Suggests:
waldo (>= 0.2.5),
withr (>= 2.3.0),
xopen,
yaml
yaml (>= 2.3.9),
Remotes:
github::jmbarbone/cnd@v0.1.1.9002,
github::jmbarbone/fuj@v0.2.2.9010
RoxygenNote: 7.3.3
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
Config/testthat/parallel: true
Config/testthat/start-first: clipboard, sourcing, write, directory
Language: en-US
Collate:
'aaa.R'
Expand All @@ -81,7 +87,7 @@ Collate:
'environments.R'
'expand.R'
'fact.R'
'fct_expand_seq.R'
'fct-expand-seq.R'
'file.R'
'fizzbuzz.R'
'funs.R'
Expand All @@ -95,6 +101,7 @@ Collate:
'lines-of-code.R'
'logic.R'
'map.R'
'mark-cnd-conditions.R'
'not-available.R'
'mark-package.R'
'match-arg.R'
Expand Down Expand Up @@ -132,3 +139,4 @@ Collate:
'utils.R'
'within.R'
'write.R'
'zzz.R'
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,13 @@ export(write_clipboard)
export(write_file_md5)
export(wuffle)
export(xnandr)
import(cnd)
import(fuj)
importFrom(cnd,class_error)
importFrom(cnd,input_error)
importFrom(cnd,input_warning)
importFrom(cnd,type_error)
importFrom(cnd,value_error)
importFrom(fuj,"%::%")
importFrom(fuj,"%:::%")
importFrom(fuj,"%colons%")
Expand Down
13 changes: 13 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# mark (development version)

* substantial changes to _conditions_
* all _conditions_ previously created with [`fuj::new_condition()`](https://jmbarbone.github.io/fuj/reference/new_condition.html) have been rewritten with [`cnd::condition()`](https://jmbarbone.github.io/cnd/reference/condition.html) [#259]
* all of these condition now use different class names, generated through [`cnd::condition()`](https://jmbarbone.github.io/cnd/reference/condition.html)
* for more information, see https://jmbarbone.github.io/cnd
* FIXME: ensure names: `{rd_name}_{thing}` -- and see about switching messages around: (`message = function(type, params)`)

* the following arguments were deprecated and unused, and have now been removed completely:
* `list2df(show_NA)`
* `vector2df(show_NA)`
* `t_df(id)`

* `merge_list(sort)` included to toggle name sorting in result

* `make_sf()` now uses `substitute()` to provide more information inside the function body when viewing [#129](https://github.com/jmbarbone/mark/issues/129)
* `round_to()` added to round values to a set [#142](https://github.com/jmbarbone/mark/issues/142)
* `is_true()`, `is_false()` now works as documented [#262](https://github.com/jmbarbone/mark/issues/262)
Expand Down
44 changes: 44 additions & 0 deletions R/aaa.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cnd_create_registry()

# nolint next: line_length_linter.
# https://github.com/RConsortium/S7/blob/e430c9aab137cc6301d5e06922e4d8cf2c0a8270/tests/testthat/helper.R#L73-L79
# modified from:
# https://github.com/RConsortium/S7/issues/466#issuecomment-2417642612
walrus <- function(sym, val) {
sym <- substitute(sym)
sym <- as.character(sym) # `"sym" <- val` is fine

val <- substitute(val)
val <- as.list(val)
val <- as.call(c(val[[1L]], sym, val[-1L]))

eval.parent(call("<-", sym, val))
}

# https://adv-r.hadley.nz/quasiquotation.html
# := is like a vestigial organ: it’s recognised by R’s parser, but it doesn’t
# have any code associated with it. It looks like an = but allows expressions on
# either side, making it a more flexible alternative to =. It is used in
# data.table for similar reasons.
`:=` <- `%:=%` <- walrus


# standard conditions -----------------------------------------------------

#' @importFrom cnd input_error input_warning value_error type_error class_error

internal_error := condition(
function(x) {
c(
x,
"\nThis is an internal `{mark}` error. If you encounter this, please",
" report an issue at <https://github.com/jmbarbone/mark/issues>"
)
},
type = "error",
help = c(
"Generic error to capture internal `{mark}` errors. If any of these are",
" encountered, please report an issue at",
" <https://github.com/jmbarbone/mark/issues>"
)
)
12 changes: 8 additions & 4 deletions R/append.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ append0.list <- function(x, values, pos = NULL, expand = FALSE, ...) {
n <- unique(lengths(x))

if (length(n) > 1) {
warning(cond_append_expand())
warning(append_warning())
n <- max(n)
}

Expand Down Expand Up @@ -64,6 +64,10 @@ append0.default <- function(x, values, pos = NULL, ...) {

# conditions --------------------------------------------------------------

cond_append_expand <- function() {
new_condition("expanding to the largest n", "append0", type = "warning")
}
# TODO does this need to be it's own condition?
append_warning := condition(
message = "expanding to the largest n",
type = "warning",
package = "mark",
exports = "insert"
)
58 changes: 9 additions & 49 deletions R/apply.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# TODO these will be deprecated by fuj::vap

# vaps --------------------------------------------------------------------

Expand All @@ -12,12 +12,12 @@
#' Each function is designed to use specific vector types:
#'
#' \describe{
#' \item{vap_int}{integer}
#' \item{vap_dbl}{double}
#' \item{vap_chr}{character}
#' \item{vap_lgl}{logical}
#' \item{vap_cplx}{complex}
#' \item{vap_date}{Date}
#' \item{[mark::vap_int()]}{integer}
#' \item{[mark::vap_dbl()]}{double}
#' \item{[mark::vap_chr()]}{character}
#' \item{[mark::vap_lgl()]}{logical}
#' \item{[mark::vap_cplx()]}{complex}
#' \item{[mark::vap_date()]}{Date}
#' }
#'
#' @param .x A vector of values
Expand Down Expand Up @@ -70,46 +70,6 @@ do_vap <- function(.x, .f, .value, ..., .nm) {
vapply(X = .x, FUN = .f, FUN.VALUE = .value, ..., USE.NAMES = .nm)
}

# This can take multiple elements, so can be a little dangerous
capply <- function(.x, .f, ..., .nm = FALSE) {
res <- do.call("c", lapply(X = .x, FUN = .f, ...))
if (.nm) {
set_names(res, names(.x) %||% res)
} else {
remove_names(res)
}
}

# A simplier implementation of sapply?
slapply <- function(x, fun, ..., .simplify = TRUE, .names = TRUE) {
res <- lapply(x, fun, ...)

if (.simplify) {
res <- simplify2array(res, higher = FALSE)
}

names(res) <- if (.names) {
if (is.null(nm <- names(x))) x else nm
} else {
NULL
}

res
}

if (FALSE) {
x <- 1:10
y <- setNames(x, x)
lapply(x, sqrt)
lapply(y, sqrt)
sapply(x, sqrt)
sapply(y, sqrt)
sapply(y, sqrt, USE.NAMES = FALSE)
sapply(x, sqrt, USE.NAMES = TRUE)
sapply(y, sqrt, USE.NAMES = TRUE)
slapply(x, sqrt)
slapply(y, sqrt)
slapply(y, sqrt, .names = FALSE)

lapply(setNames(nm = 1:10), sqrt)
capply <- function(x, f) {
do.call(base::c, lapply(x, f))
}
20 changes: 11 additions & 9 deletions R/array.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# nocov start

#' Array extract
#'
#' Extract dimensions from an array
Expand All @@ -16,13 +18,20 @@
#' array_extract(x, `2` = 2, `3` = 3)

array_extract <- function(.arr, ..., default = "1") {
# what was even the point of this?
.Deprecated(
msg = c(
"`array_extract()` is deprecated.",
" Please use standard R array indexing instead, e.g., `arr[1, 2, 3]`."
)
)
stopifnot(is.array(.arr))

ls <- rlang::list2(...)
nm <- wuffle(as.integer(names(ls) %||% seq_along(ls)))

if (anyNA(nm)) {
stop(cond_arary_extract_names())
stop(input_error("... must be fully named by integers or have no names"))
}

ds <- dim(.arr)
Expand Down Expand Up @@ -52,11 +61,4 @@ array_extract <- function(.arr, ..., default = "1") {
eval(str2expression(text), envir = parent.frame())
}

# conditions --------------------------------------------------------------

cond_arary_extract_names <- function() {
new_condition(
"... must be fully named by integers or have no names",
"array_extract_names"
)
}
# nocov end
Loading
Loading