read_import_file: Read a raw file for importing to stock db

Description Usage Arguments Value See Also

View source: R/data-mgt.R

Description

Read a raw file into a dataframe for processing or importing.

Usage

1
2
3
4
5
6
7
8
9
read_import_file(
  input_file,
  input_template = NULL,
  input_type = c("csv", "txt"),
  input_dir = NULL,
  start_index = 2L,
  ignore_problems = TRUE,
  log_dir = "./log"
)

Arguments

input_file

A character of name or path of input data file, which could use regular expression to read multiple files into a combined dataframe, e.g. test[0-9]*.txt" will read files like test.txt, test1.txt,..., test9.txt..., etc., the files ware queued in ascending alphabet order.

input_template

A character of name of input template file. Default NULL means use as input_file when reading single files or the first file in input_file when reading multiple files.

input_type

A character of input file format, e.g. "txt", "csv".

input_dir

A path of working dir of input file, if NULL, use dir of input file as working dir, default NULL.

start_index

A integer of start index of first line of actual records in data file, by default 2L, which means first line is header and actual data starts from second line.

ignore_problems

A logic flag to determine whether to ignore problems when covert data, if TRUE, continue to import data but log problems into log file, otherwise abort reading process. By default TRUE.

log_dir

Path of log dir for saving problem log file, by default"./log", if the log path doesn't existed, it will be created.

Value

A dataframe of raw data for importing if succeed, otherwise NULL.

See Also

Other data management: clear_tables(), convert_import_file(), get_datasource(), import_table(), process_files(), ttm_financial_report(), update_db(), write_import_file()


chriszheng2016/zstmodelr documentation built on June 13, 2021, 8:59 p.m.