varsDifferentTypes: Identify Variables of Different Types.

View source: R/varsDifferentTypes.R

varsDifferentTypesR Documentation

Identify Variables of Different Types.

Description

Identifies the variables in common across two dataframes that have different types.

Usage

varsDifferentTypes(df1, df2)

Arguments

df1

dataframe 1 (object)

df2

dataframe 2 (object)

Details

Identifies the variables that have the same name across two dataframes that have different types, which can pose challenges for merging two dataframes.

Value

Dataframe with columns for the variable name, the variable type in df1 and the variable type in df2.

See Also

Other dataManipulation: columnBindFill(), convert.magic(), dropColsWithAllNA(), dropRowsWithAllNA()

Examples

# Prepare Data
df1 <- data.frame(
  A = 1:3,
  B = 2:4,
  C = 3:5
)

df2 <- data.frame(
  A = as.character(1:3),
  B = 2:4,
  C = as.factor(3:5)
)

# Check if any rows are not NA
varsDifferentTypes(df1, df2)

petersenlab documentation built on April 4, 2025, 12:22 a.m.