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

Closes #174 Specify domain filtering uses environment domain variable #256

Merged
merged 4 commits into from
Mar 8, 2024
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
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* All `xportr` functions now have `verbose = NULL` as the default (#151)

* Bug fix for domain filtering (#137)

## Documentation

* Remove unused packages from Suggests (#221)

* `xportr_write()` now accepts `metadata` argument which can be used to set the dataset label to stay consistent with the other `xportr_*` functions. It is noteworthy that the dataset label set using the `xportr_df_label()` function will be retained during the `xportr_write()`.
Expand Down
2 changes: 1 addition & 1 deletion R/df_label.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ xportr_df_label <- function(.df,
if (inherits(metadata, "Metacore")) metadata <- metadata$ds_spec

label <- metadata %>%
filter(!!sym(domain_name) == domain) %>%
filter(!!sym(domain_name) == .env$domain) %>%
select(!!sym(label_name)) %>%
# If a dataframe is used this will also be a dataframe, change to character.
as.character()
Expand Down
2 changes: 1 addition & 1 deletion R/format.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ xportr_format <- function(.df,

if (domain_name %in% names(metadata) && !is.null(domain)) {
metadata <- metadata %>%
filter(!!sym(domain_name) == domain & !is.na(!!sym(format_name)))
filter(!!sym(domain_name) == .env$domain & !is.na(!!sym(format_name)))
} else {
# Common check for multiple variables name
check_multiple_var_specs(metadata, variable_name)
Expand Down
2 changes: 1 addition & 1 deletion R/label.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ xportr_label <- function(.df,

if (domain_name %in% names(metadata) && !is.null(domain)) {
metadata <- metadata %>%
dplyr::filter(!!sym(domain_name) == domain)
dplyr::filter(!!sym(domain_name) == .env$domain)
} else {
# Common check for multiple variables name
check_multiple_var_specs(metadata, variable_name)
Expand Down
2 changes: 1 addition & 1 deletion R/length.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ xportr_length <- function(.df,

if (domain_name %in% names(metadata) && !is.null(domain)) {
metadata <- metadata %>%
filter(!!sym(domain_name) == domain)
filter(!!sym(domain_name) == .env$domain)
} else {
# Common check for multiple variables name
check_multiple_var_specs(metadata, variable_name)
Expand Down
2 changes: 1 addition & 1 deletion R/order.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ xportr_order <- function(.df,

if (domain_name %in% names(metadata) && !is.null(domain)) {
metadata <- metadata %>%
dplyr::filter(!!sym(domain_name) == domain & !is.na(!!sym(order_name)))
dplyr::filter(!!sym(domain_name) == .env$domain & !is.na(!!sym(order_name)))
} else {
metadata <- metadata %>%
dplyr::filter(!is.na(!!sym(order_name)))
Expand Down
2 changes: 1 addition & 1 deletion R/type.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ xportr_type <- function(.df,

if (domain_name %in% names(metadata) && !is.null(domain)) {
metadata <- metadata %>%
filter(!!sym(domain_name) == domain)
filter(!!sym(domain_name) == .env$domain)
}

metacore <- metadata %>%
Expand Down
Loading