divide_cols_by: Divide a set of columns by a number

View source: R/calculations.R

divide_cols_byR Documentation

Divide a set of columns by a number

Description

divide_cols_by takes a data frame or tibble object, a set of column names in a vector, any real number and divides the values in the cols argument by that number and returns the tbl.

Usage

divide_cols_by(data = NULL, cols = NULL, by = 100)

Arguments

data

Data frame or tibble object

cols

Vector of one or more columns in data to operate on

by

Number to divide by. Default is 100

Details

Used in scripts: Robust function: FALSE

TO IMPROVE:

  • Check that data is not NULL, if return NULL

  • Make column names not case sensitive

  • Check which column(s) are and are not in the dataset, throw warning if any are missing, and operate only on those that are in the dataset

  • Check the classes of the passed columns to ensure they are numeric and possible to divide by by. If not attempt to convert to numeric, else throw a warning that those columns are not operated on

Value

Data frame


AndreSjuve/dretools documentation built on Dec. 4, 2024, 3:12 a.m.