R2SQL_types: From R class names to SQLite data types

View source: R/utils.R

R2SQL_typesR Documentation

From R class names to SQLite data types

Description

The R2SQL_types() function returns a character vector with the names of SQLite data types corresponding to the R classes passed through the x parameter.

If any class is not recognized, it will be replaced with TEXT data type.

Usage

R2SQL_types(x)

Arguments

x

character, a vector containing the strings with the R class names.

Value

a character vector with the names of SQLite data types.

Examples

# Convert R data types to SQLite types
r_types <- c("character", "integer", "numeric", "logical", "Date")
sql_types <- R2SQL_types(r_types)

# Display the mapping
data.frame(
  R_type = r_types,
  SQLite_type = sql_types,
  row.names = NULL
)

# Handle unknown types (converted to TEXT)
mixed_types <- c("character", "unknown_type", "integer")
R2SQL_types(mixed_types)


RSQLite.toolkit documentation built on Sept. 2, 2026, 9:06 a.m.