require_data_in_samples: Drop my_dt columns that aren't present in certain...

View source: R/stackable_functions.R

require_data_in_samplesR Documentation

Drop my_dt columns that aren't present in certain percentage_of_samples according to requirement function

Description

Allows you drop columns that don't meet criteria for X

Usage

require_data_in_samples(
  my_dt = NULL,
  col_names = NULL,
  my_summary = "Require data in smaples",
  percentage_of_samples = 75,
  requirement = function(x) {
     sum(x > 0)
 },
  sample_key = get_default_sample_key(),
  readme_path = NULL
)

Arguments

my_dt

data.table input

col_names

Vector of character strings to name the columns that will have this operation performed on them. Uses operatable_columns

my_summary

Character string to change the default comment that will be appended to my_dt.

percentage_of_samples

Percentage of samples that will need to meet the requirement to keep the column

requirement

Function by which to judge the column. For example the default (function(x){sum(x>0)}) requires that the value be greater than zero in 75 percent of the samples.

sample_key

Character string to specify the column that is the sample key. This column will not be operated upon.

readme_path

Optional path to which the comments will be appended.

Details

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ require_data_in_samples ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Benjamin-Vincent-Lab/binfotron documentation built on Oct. 1, 2024, 8:33 p.m.