-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 333_fix_datanames_assigment@main
- Loading branch information
Showing
17 changed files
with
181 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Type: Package | ||
Package: teal.data | ||
Title: Data Model for 'teal' Applications | ||
Version: 0.6.0.9016 | ||
Version: 0.6.0.9017 | ||
Date: 2024-11-08 | ||
Authors@R: c( | ||
person("Dawid", "Kaledkowski", , "[email protected]", role = c("aut", "cre"), | ||
|
@@ -72,10 +72,11 @@ Collate: | |
'join_keys.R' | ||
'teal.data.R' | ||
'teal_data-class.R' | ||
'teal_data-constructor.R' | ||
'teal_data-extract.R' | ||
'teal_data-get_code.R' | ||
'teal_data-names.R' | ||
'teal_data-show.R' | ||
'teal_data.R' | ||
'testhat-helpers.R' | ||
'topological_sort.R' | ||
'verify.R' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# teal.data 0.6.0.9016 | ||
# teal.data 0.6.0.9017 | ||
|
||
### Breaking changes | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#' | ||
#' @section Subsetting: | ||
#' `x[names]` subsets objects in `teal_data` environment and limit the code to the necessary needed to build limited | ||
#' objects. | ||
#' | ||
#' @param names (`character`) names of objects included in `teal_subset` to subset | ||
#' @param x (`teal_data`) | ||
#' | ||
#' @examples | ||
#' | ||
#' # Subsetting | ||
#' data <- teal_data() | ||
#' data <- eval_code(data, "a <- 1;b<-2") | ||
#' data["a"] | ||
#' data[c("a", "b")] | ||
#' | ||
#' join_keys(data) <- join_keys(join_key("a", "b", "x")) | ||
#' join_keys(data["a"]) # should show empty keys | ||
#' join_keys(data["b"]) | ||
#' join_keys(data)["a"] # should show empty keys | ||
#' join_keys(data)["b"] | ||
#' | ||
#' @rdname teal_data | ||
#' | ||
#' @export | ||
`[.teal_data` <- function(x, names) { | ||
x <- NextMethod("`[`", x, check_code_names = x@verified) # unverified doesn't need warning for code inconsistency | ||
x@join_keys <- x@join_keys[names] | ||
x | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# use non-exported function from teal.code | ||
lang2calls <- getFromNamespace("lang2calls", "teal.code") | ||
extract_dependency <- getFromNamespace("extract_dependency", "teal.code") | ||
split_code <- getFromNamespace("split_code", "teal.code") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
testthat::test_that("`[.` subsets join_keys also", { | ||
data <- teal_data(a = 1, b = 2) | ||
join_keys(data) <- join_keys(join_key("a", "b", "x")) | ||
testthat::expect_length(join_keys(data["a"]), 0) | ||
}) | ||
|
||
testthat::test_that("`[.` preserves @verified field", { | ||
testthat::expect_false(teal_data(a = 1, b = 2)["a"]@verified) | ||
testthat::expect_true(within(teal_data(), a <- 1)["a"]@verified) | ||
}) | ||
|
||
testthat::test_that("`[.` warns and subsets if names are present in code", { | ||
data <- teal_data(a = 1, b = 2, code = "a <- 1; b <- 2; c <- 3; d <- 4") | ||
testthat::expect_warning( | ||
subset <- data[c("a", "c", "d")], | ||
"Some 'names' do not exist in the environment of the 'teal_data'. Skipping those: c, d." | ||
) | ||
testthat::expect_identical(subset@code, data@code[c(1, 3, 4)]) | ||
testthat::expect_identical(as.list(subset), as.list(data)[1]) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.