Learn R Programming

W4MRUtils (version 1.0.0)

df_read_table: Data frame loading from a file.

Description

df_read_table Reads a data frame from a file and possibly convert integer columns to numeric. This function calls the built-in read.table() method and then W4MRUtils::df_force_numeric().

Usage

df_read_table(file, force_numeric = FALSE, ...)

Value

The loaded data frame.

Arguments

file

The path to the file you want to load. See read.table() documentation for more information.

force_numeric

If set to TRUE, all integer columns will be converted to numeric.

...

Parameter to transmit to the read.table function.

Examples

Run this code
# Load a data frame from a file and convert integer columns
file_path <- system.file(
  "extdata",
  "example_df_read_table.csv",
  package="W4MRUtils"
)
str(W4MRUtils::df_read_table(
  file_path,
  sep = ",",
  force_numeric = TRUE,
  header=TRUE
))

Run the code above in your browser using DataLab