Skip to contents

Reads all text files in a folder and creates a flat_table object. Each file is expected to contain a flat table, all with the same structure, whose first row contains the name of the columns. All columns are considered to be of type String.

Usage

read_flat_table_folder(
  name,
  folder,
  sep = ",",
  page = NULL,
  unknown_value = NULL,
  same_columns = FALSE,
  snake_case = FALSE
)

Arguments

name

A string, flat table name.

folder

A string, folder name.

sep

Column separator character.

page

A string, name of the new field in which to include the name of the file.

unknown_value

A string, value used to replace empty and NA values in attributes.

same_columns

A boolean, indicates whether all tables have the same columns in the same order.

snake_case

A boolean, indicates if we want to transform the names of the columns to snake case.

Value

A flat_table object.

Details

When multiple files are handled, the file name may contain information associated with the flat table, it could be the table page information if the name of a new field in which to store it is indicated.

We can also indicate the value that is used in the data with undefined values.

In some situations all the files have the same structure but the column names may change slightly. In these cases it can be useful to transform the names to snake case or consider for all the files the names of the columns of the first one. These operations can be indicated by the corresponding parameters.

Examples


file <- system.file("extdata/mrs", package = "rolap")

ft <- read_flat_table_folder('mrs_new', file)