generate_yaml | R Documentation |
YAML files can be helpful for uploading data to SQL efficiently and correctly. This function should enable the user to create a standard YAML file that be be used to push data from R to SQL.
This function expects data in the form of a data.frame or data.table
generate_yaml(
mydt,
outfile = NULL,
datasource = NULL,
schema = NULL,
table = NULL
)
mydt |
the name of a data.table or data.frame for which you want to create a YAML file |
outfile |
optional character vector of length one. The complete filepath for where the *.yaml file should be saved. If it is not specified, the YAML file will be returned in memory |
datasource |
A character vector of length one. A human readable description of the datasource to be uploaded to SQL. This could be a filepath to the original data on a shared drive or a simple description. |
schema |
A character vector of length one. The schema to be used within the specific server and database that will be specified in your odbc connection. |
table |
A character vector of length one. The table to be used within the specific server and database that will be specified in your odbc connection and within the schema that you specified above. |
a list with the YAML file contents (if outfile not specified) or a message stating where the YAML file has been saved (if outfile was specified)
data(mtcars)
# output to object in memory
check <- generate_yaml(mtcars, schema = "SCH", table = "TBL",
datasource = "R standard mtcars")
# output to a file
output_file <- tempfile('output_file', fileext = ".yaml")
generate_yaml(mtcars, outfile = output_file, schema = "SCH", table = "TBL",
datasource = "R standard mtcars")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.