df_force_numeric {W4MRUtils}R Documentation

Convert data frame to numeric.

Description

df_force_numeric Converts integer columns of a data frame into numeric.

Usage

df_force_numeric(df, cols = NULL)

Arguments

df

The data frame.

cols

The set of columns to convert to numeric. By default (when set to NULL) all integer columns are converted. Set it to a character vector containing the names of the columns you want to convert, or ton integer vector containing the indices of the columns. Can be used to force conversion of non integer columns.

Value

The converted data.frame.

Examples

# Convert an integer data frame
df <- data.frame(a = as.integer(c(1, 4)), b = as.integer(c(6, 5)))
df <- W4MRUtils::df_force_numeric(df)


[Package W4MRUtils version 1.0.0 Index]