How to compare data of columns across multiple data frames in R

I have 15 different data frames with same number of columns and column names. But some of these columns are indicated to be of different data types. Without checking manually is there a method to detect the data type of the columns that does not share the same data type?


df1 <- data.frame(
  a=1:3,  b=1:3,  c=1:3
)
df2 <- data.frame(
  a=1:3,  b=1:3,  c=as.character(1:3),
  stringsAsFactors = FALSE
)

(dfs_to_look_at <- list(df1,df2))

library(purrr)

  map_dfr(dfs_to_look_at,
            ~map_chr(.,typeof)) 
# A tibble: 2 x 3
  a       b       c        
  <chr>   <chr>   <chr>    
1 integer integer integer  
2 integer integer character

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.