f_read_data_from_file: Read data from file

View source: R/f - Read data from file.R

f_read_data_from_fileR Documentation

Read data from file

Description

Reads data from file.

Usage

f_read_data_from_file(
  v.file.string = NULL,
  c.file.type,
  c.path = NULL,
  b.exact.match = FALSE,
  c.file.string.exclude = NULL,
  b.show.info = FALSE,
  c.sheet.name = NULL,
  n.skip.rows = 0,
  c.delim = NULL,
  b.col.names = TRUE,
  l.col.type = NULL,
  n.guess.max = 1000,
  c.table.name = NULL,
  c.show.report = "all",
  b.add.mod.date.path.file = FALSE,
  b.clean.up.header.names = TRUE
)

Arguments

v.file.string

String to search for in the filename. In case of Google Sheet this can be kept NULL (default: NULL).

c.file.type

Options: 'xls', 'csv', 'tsv', 'txt', 'delim', 'rds', 'fst', 'xml', 'parquet', 'sqlite', 'shp', 'dbf', 'gs'

c.path

Path where file should be searched for (default: NULL).

b.exact.match

Exact match or not (default: FALSE).

c.file.string.exclude

Means to filter out files by providing a string that should not exist in the filename (default: NULL).

b.show.info

Should we show info? (default: FALSE).

c.sheet.name

In case of xls (default: NULL).

n.skip.rows

In case of xls (default: 0).

c.delim

In case of txt, csv, delim (default: NULL).

b.col.names

Do the data contain header names? (default: TRUE).

l.col.type

List with column types, see also Details (default: NULL).

n.guess.max

Number of rows to check on data type (default: 1000).

c.table.name

In case of SQLITE (default: NULL).

c.show.report

Options: "none", "minimal", "all" (default: "all").

b.add.mod.date.path.file

Should we add auxiliry features: mod.date, path.file? (default: FALSE).

b.clean.up.header.names

Should we clean up the header names? (default: TRUE).

Details

In case of Excel file, l.col.type should consist of list of: "skip", "guess", "logical", "numeric", "date", "text" or "list". In case of delimited file, l.col.type should consist of list of: c = character, i = integer, n = number, d = double, l = logical, D = date, T = date time, t = time, ? = guess, or _/- to skip the column.

Value

Data frame containing the data read from the file.

Author(s)

Pieter Overdevest

Examples

f_read_data_from_file(

     v.file.string            = "bord.allocation",
     c.file.type              = "xls",
     c.path                   = path.data,
     b.exact.match            = FALSE,
     c.file.string.exclude    = NULL,
     b.show.info              = FALSE,
     c.sheet.name             = NULL,
     n.skip.rows              = 0,
     c.delim                  = NULL,
     b.col.names              = TRUE,
     l.col.type               = NULL,
     n.guess.max              = 1000,
     c.table.name             = NULL,
     c.show.report            = "all",
     b.add.mod.date.path.file = FALSE,
     b.clean.up.header.names  = TRUE
)

pieterov/generaltoolbox documentation built on Jan. 25, 2025, 10:32 a.m.