tests/testthat/test-data-type.R

# Taken from DBI
test_that("dbDataType works on a data frame", {
  con <- postgresDefault()
  on.exit(dbDisconnect(con))

  df <- data.frame(x = 1:10, y = 1:10 / 2)
  types <- dbDataType(con, df)

  expect_equal(types, c(x = "INTEGER", y = "DOUBLE PRECISION"))
})

Try the RPostgres package in your browser

Any scripts or data that you put into this service are public.

RPostgres documentation built on Oct. 23, 2023, 1:06 a.m.