Learn R Programming

sqlHelpers (version 0.1.2)

create_table_from_data_frame: Generate a CREATE TABLE statement based on a data.frame, optionally execute the statement if con is not NULL.

Description

Generate a CREATE TABLE statement based on a data.frame, optionally execute the statement if con is not NULL.

Usage

create_table_from_data_frame(x, table_name, con = NULL)

Value

A string, the CREATE TABLE statement; or the results retrieved by DBI::dbSendQuery after executing the statement.

Arguments

x

A data.frame.

table_name

A string, the name of the SQL table to create.

con

A database connection that can be passed to DBI::dbSendQuery/DBI::dbGetQuery.

Examples

Run this code
create_table_from_data_frame(x = iris, table_name = "test")

Run the code above in your browser using DataLab