The get_class() gets class of variables in data.frame or tbl_df.
get_class(df)
a data.frame or objects inheriting from data.frame
a data.frame Variables of data.frame is as follows.
variable : variables name
class : class of variables
# data.frame
get_class(iris)
#> variable class
#> 1 Sepal.Length numeric
#> 2 Sepal.Width numeric
#> 3 Petal.Length numeric
#> 4 Petal.Width numeric
#> 5 Species factor
# tbl_df
get_class(ggplot2::diamonds)
#> variable class
#> 1 carat numeric
#> 2 cut ordered
#> 3 color ordered
#> 4 clarity ordered
#> 5 depth numeric
#> 6 table numeric
#> 7 price integer
#> 8 x numeric
#> 9 y numeric
#> 10 z numeric
library(dplyr)
ggplot2::diamonds %>%
get_class() %>%
filter(class %in% c("integer", "numeric"))
#> variable class
#> 1 carat numeric
#> 2 depth numeric
#> 3 table numeric
#> 4 price integer
#> 5 x numeric
#> 6 y numeric
#> 7 z numeric