View source: R/identify_common_columns.R
identify_common_columns | R Documentation |
Checks whether the input arguments have the same columns
identify_common_columns(...)
## S3 method for class 'data.frame'
identify_common_columns(...)
## S3 method for class 'exdf'
identify_common_columns(...)
... |
One or more R objects that have column names. |
identify_common_columns
is generic, with methods defined for data
frames and exdf
objects. In the case of exdf
objects, a column
will only be considered common if it has the same name, units, and category in
all of the input objects.
A character vector of the column names that are common to all the input objects.
exdf
# Here we create two exdf objects with the same column names and units, but
# where the categories of one column are not the same in both objects
exdf_1 <- exdf(
data.frame(A = c(3, 2, 7, 9), B = c(4, 5, 1, 8)),
data.frame(A = 'm', B = 's'),
data.frame(A = 'Cat1', B = 'Cat2')
)
exdf_2 <- exdf(
data.frame(A = c(3, 2, 7, 9), B = c(4, 5, 1, 8)),
data.frame(A = 'm', B = 's'),
data.frame(A = 'Cat1', B = 'Cat3')
)
# Calling `identify_common_columns` on the exdf objects will only identify one
# common column (A) because the category for column B is not common to all the
# exdf objects.
identify_common_columns(exdf_1, exdf_2)
# Calling `identify_common_columns` on the main_data data frames will identify
# two common columns because unit and category information will not be
# considered here.
identify_common_columns(exdf_1$main_data, exdf_2$main_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.