The get_column_info() retrieves the column information of the DBMS table through the tbl_bdi object of dplyr.
get_column_info(df)
df | a tbl_dbi. |
---|
An object of data.frame.
SQLite DBMS connected RSQLite::SQLite():
name: column name
type: data type in R
MySQL/MariaDB DBMS connected RMySQL::MySQL():
name: column name
Sclass: data type in R
type: data type of column in the DBMS
length: data length in the DBMS
Oracle DBMS connected ROracle::dbConnect():
name: column name
Sclass: column type in R
type: data type of column in the DBMS
len: length of column(CHAR/VARCHAR/VARCHAR2 data type) in the DBMS
precision: precision of column(NUMBER data type) in the DBMS
scale: decimal places of column(NUMBER data type) in the DBMS
nullOK: nullability
# \donttest{ library(dplyr) # connect DBMS con_sqlite <- DBI::dbConnect(RSQLite::SQLite(), ":memory:") # copy heartfailure to the DBMS with a table named TB_HEARTFAILURE copy_to(con_sqlite, heartfailure, name = "TB_HEARTFAILURE", overwrite = TRUE) con_sqlite %>% tbl("TB_HEARTFAILURE") %>% get_column_info#> name type #> 1 age integer #> 2 anaemia character #> 3 cpk_enzyme double #> 4 diabetes character #> 5 ejection_fraction double #> 6 hblood_pressure character #> 7 platelets double #> 8 creatinine double #> 9 sodium double #> 10 sex character #> 11 smoking character #> 12 time integer #> 13 death_event character