Get Started →
Type & Coercion Errors

Join type mismatch

Matches: Can't join on .* incompatible types

WHAT THIS ERROR MEANS

You tried to join two data frames on a column, but the column has different types in each data frame (e.g., character vs numeric).

HOW TO FIX IT

1. Check column types in both data frames with str() or class().

2. Convert one to match the other before joining.

3. Use mutate() to coerce the join column.

CODE EXAMPLES

BAD — THIS CAUSES THE ERROR
# df1$id is numeric, df2$id is character
left_join(df1, df2, by = "id")
GOOD — CORRECT APPROACH
df2 <- df2 %>% mutate(id = as.numeric(id))
left_join(df1, df2, by = "id")

Still stuck?

Paste your code in RChat and the AI will fix this error in context.

Try RChat Free →

RELATED TYPE & COERCION ERRORS