A Complete Error Dictionary (A-Z)

This appendix provides an alphabetical quick reference of all errors covered in the book. Each entry includes:

  • Error message
  • Chapter reference
  • Quick fix
  • Difficulty level

Use Ctrl+F (Cmd+F on Mac) to search for specific error text.


A.1 A

A.1.1 All aesthetics have length 1, but data has X rows

Package: ggplot2
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Pass a data frame to ggplot(), not individual vectors
Example:

# Wrong:
ggplot() + geom_point(aes(x = 1:10, y = 1:10))

# Right:
df <- data.frame(x = 1:10, y = 1:10)
ggplot(df) + geom_point(aes(x, y))

A.1.2 argument "x" is missing, with no default

Package: base
Chapter: ??
Difficulty:
Quick Fix: Provide the required argument or set a default value
Example:

# Function needs argument:
my_func <- function(x) { x + 1 }
my_func()  # Error!

# Fix: provide it:
my_func(5)

# Or give it a default:
my_func <- function(x = 0) { x + 1 }

A.1.3 argument is not interpretable as logical

Package: base
Chapter: 18
Difficulty:
Quick Fix: Ensure condition evaluates to TRUE/FALSE
Example:

# Wrong:
if ("yes") { }  # Character not logical

# Right:
if (TRUE) { }

A.1.4 argument is of length zero

Package: base
Chapter: 18
Difficulty: ⭐⭐
Quick Fix: Check for empty vectors before using in if()
Example:

x <- numeric(0)
if (x > 5) { }  # Error!

# Fix:
if (length(x) > 0 && x > 5) { }

A.1.5 arguments imply differing number of rows: X, Y

Package: base
Chapter: 9
Difficulty:
Quick Fix: Ensure all columns have same length or use recycling explicitly
Example:

# Wrong:
data.frame(a = 1:5, b = 1:3)  # Error!

# Right:
data.frame(a = 1:5, b = rep(1:3, length.out = 5))

A.2 B

A.2.1 bytecode version mismatch

Package: base
Chapter: ??
Difficulty: ⭐⭐⭐
Quick Fix: Reinstall packages after R update

A.2.2 by must specify column(s) as numbers, names or logical

Package: base
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Check merge/aggregate by argument format


A.3 C

A.3.1 Can't combine <type1> and <type2>

Package: dplyr
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Convert columns to compatible types before combining
Example:

# If binding rows with incompatible types:
df1 <- data.frame(x = 1:5)
df2 <- data.frame(x = letters[1:5])
bind_rows(df1, df2)  # Error!

# Fix: make types consistent
df2$x <- as.character(df2$x)

A.3.2 Can't rename columns that don't exist

Package: dplyr
Chapter: ??
Difficulty:
Quick Fix: Check column name spelling

A.3.3 Can't subset columns that don't exist

Package: dplyr
Chapter: ??
Difficulty:
Quick Fix: Verify column names with names() or colnames()

A.3.4 cannot allocate vector of size X

Package: base
Chapter: ??
Difficulty: ⭐⭐⭐
Quick Fix: Reduce data size, use data.table, or add RAM
See also: Memory management techniques in Chapter ??

A.3.5 cannot change value of locked binding for 'X'

Package: base
Chapter: 3
Difficulty:
Quick Fix: Don’t try to reassign T, F, or other protected objects

A.3.6 cannot change working directory

Package: base
Chapter: 2
Difficulty:
Quick Fix: Check path exists and you have permission

A.3.7 cannot coerce class "X" to a data.frame

Package: base
Chapter: 4
Difficulty: ⭐⭐
Quick Fix: Convert object to appropriate type first

A.3.8 cannot open file 'X': No such file or directory

Package: base
Chapter: 2
Difficulty:
Quick Fix: Check file path and working directory with getwd()
See also: File path best practices in Chapter 2

A.3.9 cannot open the connection

Package: base
Chapter: 2
Difficulty: ⭐⭐
Quick Fix: Close file in other programs, check file path

A.3.10 character string is not in a standard unambiguous format

Package: base
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Specify date format explicitly with format argument

A.3.11 column 'X' not found

Package: various
Chapter: 10
Difficulty:
Quick Fix: Check spelling and use names(data) to verify

A.3.12 contexts stack overflow

Package: base
Chapter: ??
Difficulty: ⭐⭐⭐
Quick Fix: Check for infinite recursion

A.3.13 contrasts can be applied only to factors with 2 or more levels

Package: stats
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Check factor has multiple levels or convert to numeric

A.3.14 could not find function "X"

Package: base
Chapter: 3
Difficulty:
Quick Fix: Load required package with library() or use package::function()
See also: Package management in Chapter ??


A.4 D

A.4.1 do not know how to convert 'X' to class "Date"

Package: base
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Use proper date parsing function like as.Date() with format

A.4.2 duplicate row.names are not allowed

Package: base
Chapter: 9
Difficulty: ⭐⭐
Quick Fix: Ensure row names are unique or use row.names = FALSE


A.5 E

A.5.1 embedded nul in string

Package: base
Chapter: 2
Difficulty: ⭐⭐⭐
Quick Fix: File is corrupted or binary; re-download or clean data

A.5.2 ERROR: dependency 'X' is not available

Package: utils
Chapter: 1
Difficulty: ⭐⭐
Quick Fix: Install with dependencies = TRUE or install dependency first

A.5.3 Error in library(X) : there is no package called 'X'

Package: base
Chapter: 1
Difficulty:
Quick Fix: Install package first: install.packages("X")

A.5.4 evaluation nested too deeply

Package: base
Chapter: ??
Difficulty: ⭐⭐⭐
Quick Fix: Increase options(expressions = ...) or fix infinite recursion


A.6 F

A.6.1 Faceting variables must have at least one value

Package: ggplot2
Chapter: 27
Difficulty: ⭐⭐
Quick Fix: Remove empty factor levels or NA values

A.6.2 figure margins too large

Package: graphics
Chapter: ??
Difficulty:
Quick Fix: Increase plot window size or adjust par(mar = ...)

A.6.3 formal argument "X" matched by multiple actual arguments

Package: base
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Don’t provide same argument twice (by name and position)


A.7 G

A.7.1 geom_X requires the following missing aesthetics: Y

Package: ggplot2
Chapter: ??
Difficulty:
Quick Fix: Provide required aesthetic mapping

A.7.2 glm.fit: algorithm did not converge

Package: stats
Chapter: ??
Difficulty: ⭐⭐⭐
Quick Fix: Increase iterations, check data scaling, simplify model


A.8 I

A.8.1 incomplete final line found

Package: base
Chapter: 2
Difficulty:
Quick Fix: Usually harmless; add newline to file or use readr

A.8.2 incorrect number of dimensions

Package: base
Chapter: 7
Difficulty:
Quick Fix: Check object dimensions with dim() or str()

A.8.3 incorrect number of subscripts on matrix

Package: base
Chapter: 7
Difficulty:
Quick Fix: Use correct number of indices [row, col]

A.8.4 installation of package 'X' had non-zero exit status

Package: utils
Chapter: 1
Difficulty: ⭐⭐
Quick Fix: Check error details, ensure dependencies installed

A.8.5 invalid factor level, NA generated

Package: base
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Add new levels to factor before assigning

A.8.6 invalid multibyte string

Package: base
Chapter: 2
Difficulty: ⭐⭐
Quick Fix: Specify file encoding: fileEncoding = "UTF-8"


A.9 L

A.9.1 lazy-load database 'X' is corrupt

Package: base
Chapter: 1
Difficulty: ⭐⭐
Quick Fix: Reinstall the package

A.9.2 longer object length is not a multiple of shorter object length

Package: base
Chapter: 5
Difficulty:
Quick Fix: Ensure vectors have compatible lengths


A.10 M

A.10.1 missing value where TRUE/FALSE needed

Package: base
Chapter: 6
Difficulty:
Quick Fix: Handle NA values before using in if() or logic

A.10.2 more columns than column names

Package: base
Chapter: 33
Difficulty: ⭐⭐
Quick Fix: Check CSV delimiter, specify sep argument


A.11 N

A.11.1 NAs introduced by coercion

Package: base
Chapter: 4
Difficulty:
Quick Fix: Check data before converting; can’t convert “abc” to number

A.11.2 need finite 'xlim' values

Package: graphics
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Remove infinite or NA values from data

A.11.3 no applicable method for 'X' applied to an object of class "Y"

Package: base
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Object type doesn’t work with that function; convert or use different function

A.11.4 non-conformable arrays

Package: base
Chapter: 11
Difficulty: ⭐⭐
Quick Fix: Ensure matrix dimensions match for operation

A.11.5 non-numeric argument to binary operator

Package: base
Chapter: 4
Difficulty:
Quick Fix: Convert character to numeric before math operations


A.12 O

A.12.1 object 'X' not found

Package: base
Chapter: 3
Difficulty:
Quick Fix: Check spelling, ensure object created, load package if needed
Most Common Error: See Chapter 3 for comprehensive guide

A.12.2 object of type 'closure' is not subsettable

Package: base
Chapter: 3
Difficulty: ⭐⭐
Quick Fix: Add () to call function, or you referenced function name instead of object


A.13 P

A.13.1 package 'X' is not available for R version Y

Package: utils
Chapter: 1
Difficulty: ⭐⭐
Quick Fix: Update R or install from archive

A.13.2 package 'X' was built before R 4.0.0

Package: base
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Reinstall package

A.13.3 pandoc document conversion failed

Package: rmarkdown
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Check pandoc installation, update RStudio

A.13.4 plot.new has not been called yet

Package: graphics
Chapter: ??
Difficulty:
Quick Fix: Create plot before adding elements

A.13.5 promise already under evaluation

Package: base
Chapter: ??
Difficulty: ⭐⭐⭐
Quick Fix: Circular dependency in default arguments; break the cycle

A.13.6 protect(): protection stack overflow

Package: base
Chapter: ??
Difficulty: ⭐⭐⭐
Quick Fix: Simplify code, reduce nested calls, restart R


A.14 R

A.14.1 rank-deficient fit may be misleading

Package: stats
Chapter: ??
Difficulty: ⭐⭐⭐
Quick Fix: Remove collinear predictors, check for perfect correlation

A.14.2 recursive indexing failed at level X

Package: base
Chapter: 8
Difficulty: ⭐⭐
Quick Fix: List element doesn’t exist or check index depth

A.14.3 Removed X rows containing missing values

Package: ggplot2
Chapter: ??
Difficulty:
Quick Fix: Handle NA values or acknowledge they’re being dropped

A.14.4 replacement has X rows, data has Y

Package: base
Chapter: 7
Difficulty: ⭐⭐
Quick Fix: Ensure replacement vector matches subset size

A.14.5 Rtools is required to build R packages but is not currently installed

Package: utils
Chapter: 1
Difficulty: ⭐⭐
Quick Fix: Install Rtools (Windows) or use binary packages


A.15 S

A.15.1 stat_count() must not be used with a y aesthetic

Package: ggplot2
Chapter: ??
Difficulty:
Quick Fix: Use geom_col() instead of geom_bar() when providing y values

A.15.2 subscript out of bounds

Package: base
Chapter: 7
Difficulty:
Quick Fix: Index is too large; check object length/dimensions

A.15.3 system is computationally singular

Package: base
Chapter: 11
Difficulty: ⭐⭐⭐
Quick Fix: Matrix not invertible; check for zero determinant


A.16 T

A.16.1 the condition has length > 1

Package: base
Chapter: 18
Difficulty: ⭐⭐
Quick Fix: Use any() or all(), or use && instead of &

A.16.2 there is no package called 'X'

Package: base
Chapter: 1
Difficulty:
Quick Fix: Install package first


A.17 U

A.17.1 unable to access index for repository

Package: utils
Chapter: 1
Difficulty:
Quick Fix: Check internet connection, try different CRAN mirror

A.17.2 undefined columns selected

Package: base
Chapter: 10
Difficulty:
Quick Fix: Check column name spelling

A.17.3 unexpected '=' in "X"

Package: base
Chapter: 3
Difficulty:
Quick Fix: Use <- for assignment or == for comparison

A.17.4 unexpected symbol in "X"

Package: base
Chapter: 3
Difficulty:
Quick Fix: Remove spaces from variable names, add missing operators

A.17.5 unused argument (X = Y)

Package: base
Chapter: ??
Difficulty:
Quick Fix: Remove incorrect argument or check function documentation


A.18 V

A.18.1 variable 'X' has no visible binding

Package: base
Chapter: ??
Difficulty: ⭐⭐⭐
Quick Fix: R CMD check issue; use .data$ pronoun or declare global

A.18.2 variable lengths differ

Package: stats
Chapter: ??
Difficulty: ⭐⭐
Quick Fix: Ensure all variables in formula have same length


A.19 W

A.19.1 Warning in install.packages : unable to access index

Package: utils
Chapter: 1
Difficulty:
Quick Fix: Check internet, try different mirror


A.20 X-Z

[Additional errors as needed]


A.21 Notes on Using This Dictionary

  1. Error text matching: Some errors have variables (like ‘X’, ‘Y’) that will show actual values
  2. Package column: Indicates which package generates the error
  3. Difficulty: ⭐ = Common beginner, ⭐⭐⭐ = Advanced/rare
  4. Quick Fix: First thing to try; full details in referenced chapter
  5. See also: Links to related errors and concepts

A.22 Can’t Find Your Error?

  1. Use the index at the beginning of book
  2. Search within relevant chapter (e.g., all ggplot errors in ggplot chapter)
  3. Check Appendix D for package-specific errors
  4. Search complete book text (Ctrl+F in HTML version)
  5. Post on Stack Overflow with [r] tag
  6. Ask on RStudio Community

A.23 Contributing Error Definitions

Found an error not listed? Submit it via GitHub issues at [repo-link]