Get Started →
Type & Coercion Errors

Non-numeric argument to operator

Matches: non-numeric argument to binary operator

WHAT THIS ERROR MEANS

You tried to do math (like +, -, *, /) on something that isn't a number, such as a character string or factor.

HOW TO FIX IT

1. Check the types of your variables with class() or str().

2. Convert to numeric with as.numeric() if appropriate.

3. Make sure you're referencing the right column.

CODE EXAMPLES

BAD — THIS CAUSES THE ERROR
"10" + 5  # "10" is a string, not a number
GOOD — CORRECT APPROACH
as.numeric("10") + 5

Still stuck?

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

Try RChat Free →

RELATED TYPE & COERCION ERRORS