Skip to content

Commit beab162

Browse files
committed
Replace tags_df with labels_df
Replacing the function and reexporting `labels_df` given that it is a crucial piece of functionality for end users.
1 parent eb5cbf1 commit beab162

File tree

10 files changed

+14
-59
lines changed

10 files changed

+14
-59
lines changed

R/labels_df.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#' @importFrom datatagr labels_df
2+
#' @export
3+
datatagr::labels_df

R/linelist-package.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#'
2020
#' * [tags()]: to get the list of tags of a `linelist`
2121
#'
22-
#' * [tags_df()]: to get a `data.frame` of all tagged variables
22+
#' * [labels_df()]: to get a `data.frame` of all tagged variables
2323
#'
2424
#' * [lost_tags_action()]: to change the behaviour of actions where tagged
2525
#' variables are lost (e.g. removing columns storing tagged variables) to

R/make_linelist.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#' * [tags_types()]: for the associated accepted types/classes
2929
#' * [tags()]: for a list of tagged variables in a `linelist`
3030
#' * [set_tags()]: for modifying tags
31-
#' * [tags_df()]: for selecting variables by tags
31+
#' * [labels_df()]: for selecting variables by tags
3232
#'
3333
#' @details Known variable types include:
3434
#'

R/select.linelist.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#' @return The function returns a `linelist` with selected columns.
2424
#'
2525
#' @seealso
26-
#' * [tags_df()] to return a `data.frame` of all tagged variables
26+
#' * [labels_df()] to return a `data.frame` of all tagged variables
2727
#'
2828
select.linelist <- function(.data, ..., tags) {
2929

R/select_tags.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' @description
55
#' `r lifecycle::badge("deprecated")`
66

7-
#' This function was equivalent to running successively [tags_df()] and
7+
#' This function was equivalent to running successively [labels_df()] and
88
#' [dplyr::select()] on a `linelist` object.
99
#' To encourage users to understand what is going on and in order to follow the
1010
#' software engineering good practice of providing just one way to do a given
@@ -21,7 +21,7 @@
2121
#'
2222
#' @seealso
2323
#' * [tags()] for existing tags in a `linelist`
24-
#' * [tags_df()] to get a `data.frame` of all tags
24+
#' * [labels_df()] to get a `data.frame` of all tags
2525
#'
2626
#' @examples
2727
#' if (require(outbreaks)) {
@@ -47,7 +47,7 @@
4747
#' # Instead, use:
4848
#' library(dplyr)
4949
#' x %>%
50-
#' tags_df() %>%
50+
#' labels_df() %>%
5151
#' select(gender, age)
5252
#' }
5353
#'
@@ -59,11 +59,11 @@ select_tags <- function(x, ...) {
5959
details =
6060
paste(
6161
"This function is deprecated:",
62-
"use the two step `tags_df()` and `dplyr::select()` process instead"
62+
"use the two step `labels_df()` and `dplyr::select()` process instead"
6363
)
6464
)
6565

66-
df <- tags_df(x)
66+
df <- labels_df(x)
6767
dplyr::select(df, ...)
6868

6969
}

R/tags_df.R

Lines changed: 0 additions & 36 deletions
This file was deleted.

R/validate_types.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
validate_types <- function(x, ref_types = tags_types()) {
3939
checkmate::assert_class(x, "linelist")
4040

41-
df_to_check <- tags_df(x)
41+
df_to_check <- labels_df(x)
4242

4343
if (!all(names(df_to_check) %in% names(ref_types))) {
4444
stop(

tests/testthat/Rplots.pdf

3.53 KB
Binary file not shown.

tests/testthat/test-tags_df.R

Lines changed: 0 additions & 12 deletions
This file was deleted.

vignettes/linelist.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ existing tags and the corresponding variables.
138138

139139
* `tags_names()`: to list all recognized tag names; details on what the tags represent can be found at [`?make_linelist`](https://epiverse-trace.github.io/linelist/reference/make_linelist.html)
140140

141-
* `tags_df()`: to obtain a `data.frame` of all the tagged variables in a `linelist`
141+
* `labels_df()`: to obtain a `data.frame` of all the tagged variables in a `linelist`
142142

143143
### Validation
144144

@@ -269,7 +269,7 @@ x %>%
269269
270270
# get all tagged variables in a data.frame
271271
x %>%
272-
tags_df()
272+
labels_df()
273273
```
274274

275275
## Using safeguards

0 commit comments

Comments
 (0)