View source: R/inspect_types.R
inspect_types | R Documentation |
For a single dataframe, summarise the column types. If two dataframes are supplied, compare column type composition of both dataframes.
inspect_types(df1, df2 = NULL, compare_index = FALSE)
df1 |
A dataframe. |
df2 |
An optional second dataframe for comparison. |
compare_index |
Whether to check column positions as well as types when comparing dataframes.
Defaults to |
For a single dataframe, the tibble returned contains the columns:
type
, a character vector containing the column types in df1
.
cnt
, integer counts of each type.
pcnt
, the percentage of all columns with each type.
col_name
, the names of columns with each type.
For a pair of dataframes, the tibble returned contains the columns:
type
, a character vector containing the column types in
df1
and df2
.
cnt_1
, cnt_2
, pair of integer columns containing counts of each type -
in each of df1
and df2
For a grouped dataframe, the tibble returned is as for a single dataframe, but where
the first k
columns are the grouping columns. There will be as many rows in the result
as there are unique combinations of the grouping variables.
A tibble summarising the count and percentage of different column types for one or a pair of data frames.
Alastair Rushworth
show_plot
# Load dplyr for starwars data & pipe library(dplyr) # Single dataframe summary inspect_types(starwars) # Paired dataframe comparison inspect_types(starwars, starwars[1:20, ])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.