-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: filter (#58) * feat: first commit filter * feat: finished client side function * refactor: changed argument name because is a core R function * chore: added correct serverside branch for CI checks * docs: added filter manual * feat: added .by argument * docs: added filter to list of completed functions * test: finished filter tests * refactor: corrected default argument * docs: added missing argument description * feat: permit additional functions to be passed * test: expanded permitted function tests for new functions being allowed to pass * docs: written vignette for filter * docs: built site * docs: added example for filter * docs: built site
- Loading branch information
Showing
14 changed files
with
469 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#' @title Keep rows that match a condition | ||
#' @description DataSHIELD implentation of \code{dplyr::filter}. | ||
#' @param df.name Character specifying a serverside data frame or tibble. | ||
#' @param expr Expressions that return a logical value, and are defined in terms of the | ||
#' variables in .data | ||
#' @param .by Optionally, a selection of columns to group by for just this operation, functioning as an alternative to \code{dplyr::group_by} | ||
#' @param .preserve Relevant when the .data input is grouped. If .preserve = FALSE (the default), | ||
#' the grouping structure is recalculated based on the resulting data, otherwise the grouping is | ||
#' kept as is. | ||
#' @param newobj Character specifying name for new server-side data frame. | ||
#' @param datasources DataSHIELD connections object. | ||
#' @return An object with the name specified by the \code{newobj} argument is written serverside. | ||
#' @importFrom DSI datashield.assign datashield.aggregate | ||
#' @examples | ||
#'\dontrun{ | ||
#' ds.filter( | ||
#' df.name = "mtcars", | ||
#' expr = list(cyl == 4 & mpg > 20), | ||
#' newobj = "filtered", | ||
#' datasources = conns) | ||
#' } | ||
#' @export | ||
ds.filter <- function(df.name = NULL, expr = NULL, .by = NULL, .preserve = FALSE, newobj = NULL, datasources = NULL) { | ||
tidy_select <- .format_args_as_string(rlang::enquo(expr)) | ||
datasources <- .set_datasources(datasources) | ||
.perform_tidyverse_checks(df.name, newobj, tidy_select, datasources) | ||
cally <- .make_serverside_call("filterDS", tidy_select, list(df.name, .by, .preserve)) | ||
datashield.assign(datasources, newobj, cally) | ||
} |
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
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 |
---|---|---|
|
@@ -4,4 +4,3 @@ pkgdown_sha: ~ | |
articles: | ||
dstidyverse: dstidyverse.html | ||
last_built: 2024-08-13T12:35Z | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.