View source: R/create_table_via_temp_file.R
This functionalizes a method of loading data into a local database that has worked as opposed to the other methods. To prevent errors in getting the nchar counts for the VARCHAR portion of the SQL statement, all true NAs are converted to "NA" at the beginning of the script. The temp file is a text file and a delimiter can be customized. The temp file is also unlinked at the end of execution. The column names are removed from the temp file before writing to avoid collisions with the column names of the empty table that will be created.
1 2 3 4 5 6 7 | create_table_via_temp_file(
dataframe,
table_name,
dbname,
schema = NULL,
delimiter = "\t"
)
|
dataframe |
dataframe to write to table |
table_name |
name of the table |
dbname |
name of database to be written to |
schema |
optional. |
delimiter |
delimiter used to write to a file and copy the contents of the file in the the SQL. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.