convert_to_df: Convert selected values from a dataframe

Description Usage Arguments Examples

View source: R/convert_to_df.R

Description

Convert selected values to target value. Input and output are both dataframes. By default 0 is replaced with NA. Non-numeric column names should be included in the exclusion argument. Columns can be selected either by exact name matching or by partial matching. For partial matching turn complete_match = FALSE.

Usage

1
2
convert_to_df(x, lab = "", value = 0, to = NA, exclusion = c(),
  complete_match = TRUE)

Arguments

x

A dataframe with values.

lab

Label to be added in each column after conversion. By default nothing is added.

value

Value to be changed. Default is 0.

to

Target value. Default is NA.

exclusion

Vector containing labels from the columns that should be excluded. Even a partial match is enough.

complete_match

Logical with default value TRUE. If exclusion vector contains exactly the column names of the excluded columns, leave the complete_match to TRUE. For partial matching of the columns switch to FALSE.

Examples

1
new_data <- convert_to_df(x, value = 0, to = NA, exclusion = c(<e2><80><9c>Protein<e2><80><9d>, <e2><80><9c>pept<e2><80><9d>))

tkostas/komics documentation built on May 24, 2019, 7:31 a.m.