# NOT RUN {
# connect using defaults
createdb("rpgtesting")
connect("rpgtesting")
begin()
# write data frame contents
data(mtcars)
write_table(mtcars)
# make "cyl" primary key (will fail unique constraint)
write_table(mtcars, pkey = "cyl", overwrite = TRUE)
# also write row names to "id"
write_table(mtcars, row_names = "id", overwrite = TRUE)
# row names as primary key
write_table(mtcars, row_names = "id", pkey = "id", overwrite = TRUE)
# default R row names and only first 3 columns
read_table("mtcars", what = "mpg, cyl, disp", limit = 3)
# row names from column "id"
read_table("mtcars", row_names = "id", limit = 3)
# get row names from primary key
read_table("mtcars", pkey_to_row_names = TRUE, limit = 3)
#cleanup
rollback()
disconnect()
dropdb("rpgtesting")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab