cas_write_to_db | R Documentation |
Generic function for writing to database
cas_write_to_db(
df,
table,
overwrite = FALSE,
db_connection = NULL,
disconnect_db = FALSE,
...
)
df |
A data frame. Must correspond with the type of data expected for each table. |
table |
Name of the table. See readme for details. |
overwrite |
Logical, defaults to FALSE. If TRUE, checks if matching data are previously held in the table and overwrites them. This should be used with caution, as it may overwrite completely the selected table. |
db_connection |
Defaults to NULL. If NULL, uses local SQLite database. If given, must be a connection object or a list with relevant connection settings (see example). |
disconnect_db |
Defaults to TRUE. If FALSE, leaves the connection to database open. |
... |
Passed to |
If successful, returns invisibly the same data frame provided as
input and written to the database. Returns silently NULL, if nothing is
added, e.g. because use_db
is set to FALSE.
Other database functions:
cas_check_db_folder()
,
cas_check_use_db()
,
cas_connect_to_db()
,
cas_create_db_folder()
,
cas_disable_db()
,
cas_disconnect_from_db()
,
cas_enable_db()
,
cas_get_db_settings()
,
cas_read_from_db()
,
cas_set_db()
,
cas_set_db_folder()
cas_set_options(
base_folder = fs::path(tempdir(), "R", "castarter_data"),
project = "example_project",
website = "example_website"
)
cas_enable_db()
urls_df <- cas_build_urls(
url = "https://www.example.com/news/",
start_page = 1,
end_page = 10
)
cas_write_to_db(
df = urls_df,
table = "index_id"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.