same_cols: Given two dataframes, which columns appear in both of them?

View source: R/dataframe_tools.R

same_colsR Documentation

Given two dataframes, which columns appear in both of them?

Description

The order of l and r doesn't matter for same_cols(), but it does for diff_cols().

Usage

same_cols(l, r)

Arguments

l

(Dataframe) A dataframe whose column names to compare.

r

(Dataframe) A dataframe whose column names to compare.

Value

A Character vector with the names of the columns that appear in both l and r.

Authors

Examples

iris1 <- iris[, 1:3]
colnames(iris1)

#> [1] "Sepal.Length" "Sepal.Width"  "Petal.Length"

iris2 <- iris[, 2:5]
colnames(iris2)
#> [1]                "Sepal.Width"  "Petal.Length" "Petal.Width"  "Species"


same_cols(iris1, iris2)
#> [1] "Sepal.Width"  "Petal.Length"


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.