Search notes:

R: DBI::dbWriteTable

The DBI function dbWriteTable can be used to write a data frame into a database.
The following example uses the RSQLite package to create a table in a SQLite database and write the data of the data frame df into it. The name of the table to be created is specified with the second parameter (here: r_table):
df <- data.frame (
   col_1 = c(   1,     2 ,      3 ),
   col_2 = c('one', 'two', 'three')
);

library(RSQLite)

db <- dbConnect(
         RSQLite::SQLite(),
         paste0(Sys.getenv('HOME'), '/dbWriteTable.test')
      );

dbWriteTable(db, 'r_data', df);

dbDisconnect(db);
Github repository about-r, path: /packages/DBI/dbWriteTable/insert-data-frame-into-SQLite.R

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745523202, '3.145.81.212', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/packages/DBI/dbWriteTable/index(50): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78