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
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ Authors@R:
role = c("aut", "cre"),
email = "luca.belmonte@efsa.europa.eu",
comment = c(ORCID = "0000-0002-7977-9170")))
Description: Brings together all the functions developed for EFSA's ad hoc data
collections, providing tools for dataset operations as well as utilities
designed to preserve data history.
Description: Provides tools for dataset operations as well as utilities
designed to preserve data history within EFSA's ad hoc data collections.
License: EUPL-1.2
URL: https://openefsa.github.io/EFSATools/
BugReports: https://github.com/openefsa/EFSATools/issues
Expand Down
16 changes: 14 additions & 2 deletions R/SCD2.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,20 @@
#' 4. Gets the current active records that are not present in the new data
#' (i.e., the records to deactivate) and deactivates them.
#'
#' @examplesIf FALSE
#' mergedData <- SCD2(newData = iris, currentData = iris)
#' @examples
#' currentData_ <- tibble::tribble(
#' ~id, ~colA, ~colB, ~colC, ~IS_ACTIVE, ~START_DATE, ~END_DATE,
#' 1, "a1", "b1", "c1", TRUE, Sys.time(), as.Date(NA),
#' 2, "a2", "b2", "c2", TRUE, Sys.time(), as.Date(NA),
#' 3, "a3", "b3", "c3", TRUE, Sys.time(), as.Date(NA))
#'
#' newData_ <- tibble::tribble(
#' ~id, ~colA, ~colB, ~colC,
#' 1, "a1", "b1", "c1",
#' 2, "a2", "b2", "c20",
#' 3, "a4", "b4", "c4")
#'
#' mergedData <- SCD2(newData = newData_, currentData = currentData_)
#'
#' @export
#'
Expand Down
16 changes: 14 additions & 2 deletions R/SSCD2.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,20 @@
#' @importFrom checkmate assert_data_frame
#' @importFrom dplyr bind_rows
#'
#' @examplesIf FALSE
#' mergedData <- SSCD2(newData = iris, currentData = iris)
#' @examples
#' currentData_ <- tibble::tribble(
#' ~id, ~colA, ~colB, ~colC, ~IS_ACTIVE, ~START_DATE, ~END_DATE,
#' 1, "a1", "b1", "c1", TRUE, Sys.time(), as.Date(NA),
#' 2, "a2", "b2", "c2", TRUE, Sys.time(), as.Date(NA),
#' 3, "a3", "b3", "c3", TRUE, Sys.time(), as.Date(NA))
#'
#' newData_ <- tibble::tribble(
#' ~id, ~colA, ~colB, ~colC,
#' 1, "a1", "b1", "c1",
#' 2, "a2", "b2", "c20",
#' 3, "a4", "b4", "c4")
#'
#' mergedData <- SSCD2(newData = newData_, currentData = currentData_)
#'
#' @export
#'
Expand Down
3 changes: 0 additions & 3 deletions R/activate.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#' @importFrom checkmate assert_data_frame
#' @importFrom dplyr mutate
#'
#' @examplesIf FALSE
#' activatedDataframe <- .activate(dataframe = dataframe)
#'
#' @keywords internal
#' @noRd
#'
Expand Down
3 changes: 0 additions & 3 deletions R/deactivate.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#' @importFrom checkmate assert_data_frame
#' @importFrom dplyr mutate
#'
#' @examplesIf FALSE
#' deactivatedDataframe <- .deactivate(dataframe = dataframe)
#'
#' @keywords internal
#' @noRd
#'
Expand Down
12 changes: 7 additions & 5 deletions R/dropEmpty.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
#' @importFrom checkmate assert_data_frame
#' @importFrom dplyr filter select where mutate_all
#'
#' @examplesIf FALSE
#' @examples
#' # The first row is going to be dropped.
#' iris[1, ] <- NA
#' iris <- dropEmpty(iris)
#' irisTest_ <- iris
#' irisTest_[1, ] <- NA
#' irisTestDropped <- dropEmpty(irisTest_)
#'
#' # The Species column is going to be dropped.
#' iris$Species <- NA
#' iris <- dropEmpty(iris)
#' irisTest_ <- iris
#' irisTest_$Test <- NA
#' irisTestDropped <- dropEmpty(irisTest_)
#'
#' @export
#'
Expand Down
4 changes: 2 additions & 2 deletions R/enrich.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
#' @importFrom dplyr select mutate left_join
#' @importFrom rlang .data :=
#'
#' @examplesIf FALSE
#' @examples
#' dataframe_ <- iris |> dplyr::rename(CODE = Species)
#'
#' catalogue_ <- iris |>
#' dplyr::rename(CODE = Species) |>
#' dplyr::mutate(NAME = "data") |>
#' dplyr::mutate(NAME = "test") |>
#' dplyr::select(CODE, NAME) |>
#' unique()
#'
Expand Down
11 changes: 6 additions & 5 deletions R/removeReplicatedColumns.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
#' replaced with NAs. Finally, the new column is bound with the other columns of
#' the initial dataframe.
#'
#' @examplesIf FALSE
#' iris$Species_1 <- iris$Species
#' iris$Species_2 <- iris$Species
#' iris$Species <- NULL
#' @examples
#' irisTest_ <- iris
#' irisTest_$Species_1 <- irisTest_$Species
#' irisTest_$Species_2 <- irisTest_$Species
#' irisTest_$Species <- NULL
#'
#' deduplicatedDataframe_ <- removeReplicatedColumns(
#' dataframe = iris,
#' dataframe = irisTest_,
#' prefix = "Species_")
#'
#' @export
Expand Down
2 changes: 1 addition & 1 deletion man/EFSATools-package.Rd

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

17 changes: 14 additions & 3 deletions man/SCD2.Rd

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

17 changes: 14 additions & 3 deletions man/SSCD2.Rd

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

13 changes: 7 additions & 6 deletions man/dropEmpty.Rd

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

5 changes: 2 additions & 3 deletions man/enrich.Rd

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

12 changes: 6 additions & 6 deletions man/removeReplicatedColumns.Rd

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