Description Usage Arguments Details Value Functions See Also
Generic function to import a raw data into target table in stock database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import_table(
stock_db,
input_file,
input_template = NULL,
input_type = c("csv", "txt"),
input_dir = NULL,
start_index = 2L,
target_table = NULL,
ignore_problems = TRUE,
log_dir = "./log",
...
)
## S4 method for signature 'gta_db'
import_table(
stock_db,
input_file,
input_template = NULL,
input_type = c("csv", "txt"),
input_dir = NULL,
start_index = 2L,
target_table = NULL,
ignore_problems = TRUE,
log_dir = "./log",
...
)
|
stock_db |
A stock database object to operate. |
input_file |
A character of name or path of input data file,
which could use regular expression to import multiple files into a table,
e.g. |
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 |
Format of input file, e.g. "txt", "csv". |
input_dir |
Working dir of input file, if NULL, use dir of input file as working dir, by default NULL, |
start_index |
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 lines. |
target_table |
Name of target table in stock db, if NULL, use basename input_file as target table , by default NULL, |
ignore_problems |
Whether to ignore problems when covert data, if TRUE, continue to import data but log problems into log file, otherwise abort importing 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. |
... |
Extra arguments to be passed to methods. |
Import process include two phrases:
Convert raw data into R data type.
Transfer R data into table in database.
Any problem in converting raw data will be logged in log file in log dir, e.g. "input_file(YYYY-MM-DD).csv"
TRUE if success, else FALSE.
import_table,gta_db-method
: import raw data into table in a database of gta_db class
Other data management:
clear_tables()
,
convert_import_file()
,
get_datasource()
,
process_files()
,
read_import_file()
,
ttm_financial_report()
,
update_db()
,
write_import_file()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.