Determine SQL Server data types from data frame. Follows SQL Server data type size constraints and chooses the smallest data type size.
Source:R/bcp.R
mapDataTypes.Rd
Determine SQL Server data types from data frame. Follows SQL Server data type size constraints and chooses the smallest data type size.
Arguments
- x
data.frame object
- coltypes
vector with names of columns to override the default data type mapping
Examples
mapDataTypes(data.frame(
int = 1:5L,
numeric = seq(0, 1, length.out = 5),
character = LETTERS[1:5],
factor = paste(LETTERS[1:5], LETTERS[1:5], sep = ''),
logical = c(TRUE, FALSE, TRUE, FALSE, TRUE),
date = seq(Sys.Date() - 4, Sys.Date(), 1L),
datetime = seq(Sys.time() - 5, Sys.time(), length.out = 5)
)
)
#> int numeric character factor logical date
#> "TINYINT" "FLOAT" "VARCHAR(1)" "VARCHAR(2)" "BIT" "DATE"
#> datetime
#> "DATETIME"