diff_fct_diff_class {MiscMetabar} | R Documentation |
Compute different functions for different class of vector.
Description
Mainly an internal function useful in "sapply(..., tapply)" methods
Usage
diff_fct_diff_class(
x,
numeric_fonction = mean,
logical_method = "TRUE_if_one",
character_method = "unique_or_na",
...
)
Arguments
x |
: a vector |
numeric_fonction |
: a function for numeric vector. For ex. |
logical_method |
: A method for logical vector. One of :
|
character_method |
: A method for character vector (and factor). One of :
|
... |
Other arguments passed on to the numeric function (ex. na.rm=TRUE) |
Value
a single value
Author(s)
Adrien Taudière
Examples
diff_fct_diff_class(
data_fungi@sam_data$Sample_id,
numeric_fonction = sum,
na.rm = TRUE
)
diff_fct_diff_class(
data_fungi@sam_data$Time,
numeric_fonction = mean,
na.rm = TRUE
)
diff_fct_diff_class(
data_fungi@sam_data$Height == "Low",
logical_method = "TRUE_if_one"
)
diff_fct_diff_class(
data_fungi@sam_data$Height == "Low",
logical_method = "NA_if_not_all_TRUE"
)
diff_fct_diff_class(
data_fungi@sam_data$Height == "Low",
logical_method = "FALSE_if_not_all_TRUE"
)
diff_fct_diff_class(
data_fungi@sam_data$Height,
character_method = "unique_or_na"
)
diff_fct_diff_class(
c("IE", "IE"),
character_method = "unique_or_na"
)
diff_fct_diff_class(
c("IE", "IE", "TE", "TE"),
character_method = "more_frequent"
)
diff_fct_diff_class(
c("IE", "IE", "TE", "TE"),
character_method = "more_frequent_without_equality"
)
[Package MiscMetabar version 0.9.1 Index]