Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@
^\.ccache$
^[.]?air[.]toml$
^\.vscode$
^\.claude$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ docs/
inst/docs/
docs
.ccache/
.claude/
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Imports:
chk,
extras,
lifecycle,
purrr,
rlang,
universals,
vctrs
Expand All @@ -37,8 +36,8 @@ Suggests:
RdMacros:
lifecycle
Config/Needs/website: poissonconsulting/poissontemplate
Config/roxygen2/version: 8.0.0.9000
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE)
Config/roxygen2/version: 8.0.0.9000
22 changes: 7 additions & 15 deletions R/deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ deprecated <- function(...) NULL
#' Replace by [is_term()]
#' @export
is.term <- function(x) {
deprecate_warn("0.1.0", what = "term::is.term()", with = "term::is_term()")
is_term(x)
deprecate_stop("0.1.0", what = "term::is.term()", with = "term::is_term()")
}

#' @describeIn deprecated Is Incomplete Terms
Expand All @@ -25,12 +24,11 @@ is.term <- function(x) {
#' Replace by [is_incomplete_terms()]
#' @export
is.incomplete_terms <- function(x) {
deprecate_warn(
deprecate_stop(
"0.1.0",
what = "term::is.incomplete_terms()",
with = "term::is_incomplete_terms()"
)
is_incomplete_terms(x)
}

#' @describeIn deprecated Is Inconsistent Terms
Expand All @@ -40,12 +38,11 @@ is.incomplete_terms <- function(x) {
#' Replace by [is_inconsistent_terms()]
#' @export
is.inconsistent_terms <- function(x) {
deprecate_warn(
deprecate_stop(
"0.1.0",
what = "term::is.inconsistent_terms()",
with = "term::is_inconsistent_terms()"
)
is_inconsistent_terms(x)
}

#' @describeIn deprecated Get Parameters
Expand All @@ -55,8 +52,7 @@ is.inconsistent_terms <- function(x) {
#' Replace by [pars()]
#' @export
parameters <- function(x, ...) {
deprecate_warn("0.1.0", what = "parameters()", with = "pars()")
pars(x, ...)
deprecate_stop("0.1.0", what = "parameters()", with = "pars()")
}


Expand All @@ -67,9 +63,7 @@ parameters <- function(x, ...) {
#' Replace by pars<-
#' @export
`parameters<-` <- function(x, value) {
deprecate_warn("0.1.0", what = "`parameters<-`()", with = "`pars<-`()")
pars(x) <- value
x
deprecate_stop("0.1.0", what = "`parameters<-`()", with = "`pars<-`()")
}

#' @describeIn deprecated Set Parameters
Expand All @@ -79,12 +73,11 @@ parameters <- function(x, ...) {
#' Replace by [set_pars()]
#' @export
set_parameters <- function(x, pars) {
deprecate_warn(
deprecate_stop(
"0.1.0",
what = "term::set_parameters()",
with = "term::set_pars()"
)
set_pars(x, pars)
}

#' @describeIn deprecated Term Index
Expand All @@ -94,6 +87,5 @@ set_parameters <- function(x, pars) {
#' Replace by [tindex()]
#' @export
tdims <- function(x) {
deprecate_warn("0.1.0", what = "term::tdims()", with = "term::tindex()")
tindex(x)
deprecate_stop("0.1.0", what = "term::tdims()", with = "term::tindex()")
}
2 changes: 1 addition & 1 deletion R/vec-cast-term.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ vec_cast.term.term_rcrd <- function(x, to, ...) {
chr <- paste0(
field(x, "par"),
"[",
purrr::map_chr(field(x, "dim"), paste, collapse = ","),
vapply(field(x, "dim"), paste, character(1), collapse = ","),
"]"
)
chr[is.na(field(x, "par"))] <- NA_character_
Expand Down
32 changes: 32 additions & 0 deletions tests/testthat/_snaps/as-term-rcrd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# as_term_rcrd.character

Code
as_term_rcrd("a", "b")
Condition
Error in `as_term.character()`:
! `repair` must be a flag (TRUE or FALSE).

# as_term_rcrd others

Code
as_term_rcrd(factor(1))
Condition
Error in `as_term_rcrd()`:
! Can't convert `x` <factor<de3a9>> to <term_rcrd>.

---

Code
as_term_rcrd(data.frame(x = 1))
Condition
Error in `as_term_rcrd()`:
! Can't convert `x` <data.frame> to <term_rcrd>.

---

Code
as_term_rcrd(TRUE)
Condition
Error in `as_term_rcrd()`:
! Can't convert `x` <logical> to <term_rcrd>.

32 changes: 32 additions & 0 deletions tests/testthat/_snaps/as-term.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# as_term.character

Code
as_term("a", "b")
Condition
Error in `as_term.character()`:
! `repair` must be a flag (TRUE or FALSE).

# as_term others

Code
as_term(factor(1))
Condition
Error in `as_term()`:
! Can't convert `x` <factor<de3a9>> to <term>.

---

Code
as_term(data.frame(x = 1))
Condition
Error in `as_term()`:
! Can't convert `x` <data.frame> to <term>.

---

Code
as_term(TRUE)
Condition
Error in `vec_restore_dispatch()`:
! Can't convert <logical> to <term>.

56 changes: 56 additions & 0 deletions tests/testthat/_snaps/chk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# chk_term

Code
chk_term(x)
Condition
Error:
! `x` must be a term vector.

---

Code
chk_term(x, validate = "valid")
Condition
Error:
! All elements of term vector `x` must be valid.

---

Code
chk_term(x, validate = "consistent")
Condition
Error:
! All elements of term vector `x` must be consistent.

---

Code
chk_term(x, validate = "complete")
Condition
Error:
! All elements of term vector `x` must be complete.

# chk_term_rcrd

Code
chk_term_rcrd(x)
Condition
Error:
! `x` must be a term_rcrd vector.

---

Code
chk_term_rcrd(x, validate = "consistent")
Condition
Error:
! All elements of term_rcrd vector `x` must be consistent.

---

Code
chk_term_rcrd(x, validate = "complete")
Condition
Error:
! All elements of term_rcrd vector `x` must be complete.

40 changes: 40 additions & 0 deletions tests/testthat/_snaps/complete-terms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# complete_terms term

Code
complete_terms(NA_term_)
Condition
Error:
! `x` must not have any missing values.

---

Code
complete_terms(new_term(c(NA_term_, "b[2]")))
Condition
Error:
! `x` must not have any missing values.

---

Code
complete_terms(new_term(c("b", "b[2,2]")))
Condition
Error in `complete_terms.term()`:
! `x` must have terms with consistent parameter dimensions.

# complete_terms term_rcrd

Code
complete_terms(term_rcrd(c(NA_term_, "b[2]")))
Condition
Error in `complete_terms.term_rcrd()`:
! `x` must not have any missing values.

---

Code
complete_terms(term_rcrd(c("b", "b[2,2]")))
Condition
Error in `complete_terms.term()`:
! `x` must have terms with consistent parameter dimensions.

64 changes: 64 additions & 0 deletions tests/testthat/_snaps/deprecated.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# deprecated functions error

Code
is.term(1)
Condition
Error:
! `is.term()` was deprecated in term 0.1.0 and is now defunct.
i Please use `is_term()` instead.

---

Code
is.incomplete_terms(term("a[1]"))
Condition
Error:
! `is.incomplete_terms()` was deprecated in term 0.1.0 and is now defunct.
i Please use `is_incomplete_terms()` instead.

---

Code
is.inconsistent_terms(term("a[1]"))
Condition
Error:
! `is.inconsistent_terms()` was deprecated in term 0.1.0 and is now defunct.
i Please use `is_inconsistent_terms()` instead.

---

Code
parameters(term("a[1]"))
Condition
Error:
! `parameters()` was deprecated in term 0.1.0 and is now defunct.
i Please use `pars()` instead.

---

Code
x <- term("a[1]")
parameters(x) <- "b"
Condition
Error:
! `parameters<-()` was deprecated in term 0.1.0 and is now defunct.
i Please use `pars<-()` instead.

---

Code
set_parameters(term("a[1]"), "b")
Condition
Error:
! `set_parameters()` was deprecated in term 0.1.0 and is now defunct.
i Please use `set_pars()` instead.

---

Code
tdims(term("a[1]"))
Condition
Error:
! `tdims()` was deprecated in term 0.1.0 and is now defunct.
i Please use `tindex()` instead.

8 changes: 8 additions & 0 deletions tests/testthat/_snaps/is-incomplete-terms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# is_incomplete_terms

Code
is_incomplete_terms(new_term(c("b", "b[2]", "b[4,] ")))
Condition
Error in `is_incomplete_terms()`:
! `x` must have terms with consistent parameter dimensions.

16 changes: 16 additions & 0 deletions tests/testthat/_snaps/npars.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# npars.term invalid elements

Code
out <- npars(new_term(c("a[2]", "b c")))
Condition
Warning in `lapply()`:
NAs introduced by coercion

# npars.term scalar invalid elements

Code
out <- npars(new_term(c("a[2]", "b c")), scalar = TRUE)
Condition
Warning in `lapply()`:
NAs introduced by coercion

16 changes: 16 additions & 0 deletions tests/testthat/_snaps/npdims.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# npdims.term

Code
npdims(new_term(c("alpha[1]", "alpha[3]", "beta[1,1]", "beta[2,1]")), terms = TRUE)
Condition
Error in `npdims.term()`:
! `...` must be unused.

---

Code
npdims(NA_term_)
Condition
Error in `npdims.term()`:
! `x` must not have any missing values.

Loading
Loading