Get Started →
41 ERRORS DOCUMENTED

R Errors

Explained & Fixed.

A complete, searchable reference of common R programming errors. Each entry includes a plain-English explanation, step-by-step fix, and code examples.

41 errors found

Object Errors

Object not found

object '([^']+)' not found

R cannot find a variable or object with the name you used. This usually means you haven't created it yet, misspelled it, or it exists in a different environment.
Function Errors

Function not found

could not find function "([^"]+)"

R doesn't recognize the function you're trying to call. The package containing it may not be loaded, or the function name is misspelled.
Function Errors

Unused argument

unused argument

You passed an argument to a function that doesn't accept it. This often happens from typos in argument names or using arguments from a different function.
Package Errors

Package not installed

there is no package called '([^']+)'

The package you're trying to load hasn't been installed on your system yet.
Package Errors

Package version mismatch

package '([^']+)' was built under R version

The installed package was compiled with a newer version of R than you're running. It may still work, but some features could be unreliable.
Package Errors

Package load failed

package or namespace load failed

The package exists but couldn't be loaded, usually because one of its dependencies is missing or incompatible.
Syntax Errors

Unexpected token

unexpected '([^']+)' in

R encountered a character or symbol it didn't expect at that position. This usually means a missing comma, parenthesis, bracket, or operator.
Syntax Errors

Unexpected end of input

unexpected end of input

R reached the end of your code but was still expecting more — usually a closing parenthesis, bracket, or brace.
Syntax Errors

Unexpected symbol

unexpected symbol in

R found two symbols next to each other without an operator or separator between them. Common cause: missing comma, pipe, or operator.
Syntax Errors

Unexpected string constant

unexpected string constant

R found a string where it wasn't expected, usually because of a missing comma or operator before it.
Syntax Errors

Extra closing parenthesis

unexpected .+\).+ in

There's an extra closing parenthesis that doesn't match any opening parenthesis.
Type & Coercion Errors

Non-numeric argument to operator

non-numeric argument to binary operator

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

Argument not numeric or logical

argument is not numeric or logical

A function that expects numbers (like mean, sum, sd) received non-numeric data such as character strings.
Type & Coercion Errors

Cannot coerce type

cannot coerce type '([^']+)' to vector of type '([^']+)'

R tried to convert one data type to another but failed because the conversion isn't possible or doesn't make sense.
Type & Coercion Errors

Invalid argument type

invalid '([^']+)' argument

An argument you passed to a function is the wrong type. The function expected one type but received another.
Type & Coercion Errors

Replacement length mismatch

replacement has (\d+) rows?, data has (\d+)

You tried to assign a value to a column or vector, but the length of the new value doesn't match the existing data.
Type & Coercion Errors

Differing number of rows

arguments imply differing number of rows

When creating a data frame, the vectors you provided have different lengths and R can't recycle them evenly.
Subscript & Indexing Errors

Subscript out of bounds

subscript out of bounds

You tried to access an element at a position that doesn't exist — like asking for the 10th element of a 5-element vector.
Subscript & Indexing Errors

Undefined columns selected

undefined columns selected

You tried to select a column that doesn't exist in your data frame, usually due to a typo or wrong column name.
Subscript & Indexing Errors

$ operator on atomic vector

\$ operator is invalid for atomic vectors

You used $ to access a named element, but the object is a simple vector, not a list or data frame.
Subscript & Indexing Errors

Incorrect number of dimensions

incorrect number of dimensions

You used multi-dimensional indexing (like [row, col]) on an object that doesn't have that many dimensions.
File & Connection Errors

Cannot open connection

cannot open the connection

R couldn't open a file or URL. The file might not exist, the path might be wrong, or you don't have permission to access it.
File & Connection Errors

File not found

no such file or directory

The file path you specified doesn't point to an existing file. The path might be wrong, or the file hasn't been created yet.
File & Connection Errors

Permission denied

cannot open file '([^']+)': Permission denied

The file exists but R doesn't have permission to read or write to it. This is an operating system restriction.
Function Errors

Missing required argument

argument "([^"]+)" is missing, with no default

A function requires a specific argument that you didn't provide, and there's no default value for it.
Function Errors

Argument matched multiple times

formal argument "([^"]+)" matched by multiple actual argumen...

You provided the same argument twice — once by name and once by position, or used the same name twice.
Memory Errors

Cannot allocate memory

cannot allocate vector of size

R ran out of memory trying to create a large object. Your data or computation requires more RAM than available.
Other Errors

Missing value in condition

missing value where TRUE\/FALSE needed

An if statement or while loop received NA instead of TRUE or FALSE. This happens when the condition evaluates to a missing value.
Other Errors

Condition has length > 1

the condition has length > 1

An if() statement received a vector with multiple values instead of a single TRUE or FALSE. if() only works with single logical values.
Function Errors

Duplicate arguments

duplicate '([^']+)' arguments

You passed the same named argument more than once to a function.
Type & Coercion Errors

Vector length not a multiple

longer object length is not a multiple of shorter object len...

You're operating on two vectors where the longer one's length is not a clean multiple of the shorter one. R will still recycle, but the result may not be what you intended.
Type & Coercion Errors

Non-conformable arguments

non-conformable arguments

Matrix multiplication or a similar operation failed because the dimensions don't match. The number of columns in the first matrix must equal the number of rows in the second.
Type & Coercion Errors

NAs from coercion

NAs introduced by coercion

R tried to convert values to another type (usually numeric) but some values couldn't be converted, so they became NA.
Function Errors

Attempt to apply non-function

attempt to apply non-function

You tried to call something as a function (using parentheses) but it isn't a function. A common cause is accidentally overwriting a built-in function name with a variable.
Function Errors

Closure is not subsettable

object of type 'closure' is not subsettable

You tried to use [ ] or $ on a function. This usually means you forgot the parentheses to call the function, or a variable has the same name as a function.
File & Connection Errors

Connection failed

cannot open connection

R failed to establish a connection to a file, URL, or database. The resource may not exist or be unreachable.
Subscript & Indexing Errors

Recursive indexing failed

recursive indexing failed

You tried to access a nested element in a list using [[ ]] but the path doesn't exist — one of the intermediate levels is NULL or missing.
Function Errors

No applicable method

no applicable method for '([^']+)'

You called a generic function on an object type it doesn't know how to handle. The function exists but has no implementation for your object's class.
Type & Coercion Errors

Replacement length not a multiple

number of items to replace is not a multiple

The number of values you're assigning doesn't evenly divide into the number of positions being replaced.
Function Errors

Missing x and y for plot

supply both 'x' and 'y' or a matrix-like

The plotting function needs either both x and y vectors, or a single matrix/data frame. You provided something it can't interpret.
Type & Coercion Errors

Unimplemented type

unimplemented type '([^']+)' in

You passed an object type that the function doesn't support. Often happens when passing a list where a vector is expected.
AI-POWERED DEBUGGING

RChat fixes R errors automatically.

Paste your error or let the AI detect it. Get an explanation in context of your actual code and apply the fix with one click.

Try RChat Free → Free tokens on signup · No credit card required