Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

210 depracate datanames in teal.data::get_code #343

Merged
merged 29 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
59a103d
deprecated datanames for teal.data::get_code
m7pr Oct 16, 2024
8d61ecc
do not add a call to the warning message
m7pr Oct 16, 2024
7a69582
update vignettes
m7pr Oct 16, 2024
3942fec
use lifecyclfe::deprecate_warn instead of warning
m7pr Oct 17, 2024
2e756e3
update documentation
m7pr Oct 17, 2024
50d02d9
remove teal.data::get_code bones (remove get_code_dependency0
m7pr Oct 17, 2024
5ca6190
update documentation to use `names` and no prefixes for teal.code
m7pr Oct 17, 2024
0c05b87
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Oct 17, 2024
c3942cd
spelling
m7pr Oct 18, 2024
6753dc8
lintr
m7pr Oct 18, 2024
45b1d41
Merge branch '218_deprecate_get_code@main' of https://github.com/insi…
m7pr Oct 18, 2024
91f5c7c
[skip style] [skip vbump] Restyle files
github-actions[bot] Oct 18, 2024
b9773d1
overwrite the class
m7pr Oct 18, 2024
8b7110e
lintr
m7pr Oct 18, 2024
530b7ba
[skip style] [skip vbump] Restyle files
github-actions[bot] Oct 18, 2024
5318d38
Update NEWS.md
m7pr Oct 18, 2024
7d1c6ee
use callNextMethod instead of setting up the class manually to qenv
m7pr Oct 18, 2024
be3a13c
Merge branch '218_deprecate_get_code@main' of https://github.com/insi…
m7pr Oct 18, 2024
d2cec0e
rename chapters in NEWS
m7pr Oct 18, 2024
c12c983
change the order of names and datanames so names is used instead of d…
m7pr Oct 18, 2024
185db46
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
dependabot-preview[bot] Oct 18, 2024
36e0a33
use lifecycle::deprecate() and lifecycle::is_present() for datanames …
m7pr Oct 18, 2024
568035d
merge
m7pr Oct 18, 2024
345f398
change the bade from experimental to deprecated
m7pr Oct 18, 2024
4ce5c54
move if before the asserts
m7pr Oct 18, 2024
c9074a3
add methods:: prefix and extract the deprecation message outside the …
m7pr Oct 18, 2024
5aa5a7f
move back to the version where only datanames is deprecated, not the …
m7pr Oct 21, 2024
dbf3c29
[skip style] [skip vbump] Restyle files
github-actions[bot] Oct 21, 2024
ff7cc1d
merge main
m7pr Oct 22, 2024
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
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# teal.data 0.6.0.9012

### Deprecations

- `get_code(datanames)` `S4` method parameter for `teal_data()` object was soft deprecated. Use `get_code(names)`.
m7pr marked this conversation as resolved.
Show resolved Hide resolved


### Enhancements

- `datanames()`
Expand Down
8 changes: 7 additions & 1 deletion R/teal_data-get_code.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Get code from `teal_data` object
#'
#' Retrieve code from `teal_data` object.
#' `r lifecycle::badge("deprecated")` Retrieve code from `teal_data` object.
#'
#' Retrieve code stored in `@code`, which (in principle) can be used to recreate all objects found in `@env`.
#' Use `datanames` to limit the code to one or more of the datasets enumerated in `@datanames`.
Expand Down Expand Up @@ -108,6 +108,12 @@ setMethod("get_code", signature = "teal_data", definition = function(object, dep
checkmate::assert_flag(deparse)

code <- if (!is.null(datanames)) {
lifecycle::deprecate_warn(
when = "0.6.1",
m7pr marked this conversation as resolved.
Show resolved Hide resolved
what = "teal.data::get_code(datanames)",
with = "teal.code::get_code(names)",
always = TRUE
)
m7pr marked this conversation as resolved.
Show resolved Hide resolved
get_code_dependency(object@code, datanames, ...)
} else {
object@code
Expand Down
2 changes: 1 addition & 1 deletion man/get_code.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vignettes/teal-data-reproducibility.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ verify(data_wrong) # fails verification, raises error
## Retrieving code

The `get_code` function is used to retrieve the code stored in a `teal_data` object.
A simple `get_code(<teal_data>)` will return the entirety of the code but using the `datanames` argument allows for obtaining a subset of the code that only deals with some of the objects stored in `teal_data`.
A simple `get_code(<teal_data>)` will return the entirety of the code but using the `names` argument allows for obtaining a subset of the code that only deals with some of the objects stored in `teal_data`.

```{r}
library(teal.data)
Expand All @@ -98,7 +98,7 @@ data <- within(teal_data(), {
head(i)
})
cat(get_code(data)) # retrieve all code
cat(get_code(data, datanames = "i")) # retrieve code for `i`
cat(get_code(data, names = "i")) # retrieve code for `i`
m7pr marked this conversation as resolved.
Show resolved Hide resolved
```

Note that in when retrieving code for a specific dataset, the result is only the code used to _create_ that dataset, not code that _uses_ is.
Expand Down
Loading