-
Notifications
You must be signed in to change notification settings - Fork 11
/
table_filter.R
33 lines (32 loc) · 877 Bytes
/
table_filter.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#' @title Table filter used to filter row by column condition.
#' @description Table filter used to filter row by column condition.
#' @author benben-miao
#'
#' @return Table: table filter used to filter row by column condition.
#' @param data Dataframe: Length, Width, Weight, and Sex traits dataframe (1st-col: Value, 2nd-col: Traits, 3rd-col: Sex).
#' @param ... Expression: multiple expressions.
#'
#' @importFrom dplyr filter
#' @export
#'
#' @examples
#' # 1. Library TOmicsVis package
#' library(TOmicsVis)
#'
#' # 2. Use example dataset
#' data(traits_sex)
#' head(traits_sex)
#'
#' # 3. Set height > 100 & eye_color == "black"
#' res <- table_filter(traits_sex, Sex == "Male" & Traits == "Weight" & Value > 40)
#' head(res)
#'
table_filter <- function(data,
...
){
res <- dplyr::filter(data,
...
)
return(res)
invisible()
}