Learn R Programming

petersenlab (version 1.1.0)

varsDifferentTypes: Identify Variables of Different Types.

Description

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

Usage

varsDifferentTypes(df1, df2)

Value

Dataframe with columns for the variable name, the variable type in df1

and the variable type in 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.

See Also

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

Examples

Run this code
# 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)

Run the code above in your browser using DataLab