4 Syntactic error
4.1 : Common syntactic error
Incorrect use of a function or incorrect values of arguments of a function
Error:
Error in file(file, "rt") : cannot open the connection
Error:
Error in setwd() : cannot change working directory
Error:
Error in library(“X”) : there is no package called ‘X’
Error:
could not find function
Error in
if
function:missing value where TRUE/FALSE is needed
Error:
Error in eval; object not found
Error:
unexpected ‘X’ in “X”
- X can be a punctuation mark, parenthesisError:
incorrect number of dimensions
Error:
subscript out of bounds
Error:
undefined columns selected
Error:
Error in x: non-numeric argument to a binary operator
Error:
unexpected numeric constant in X
Error:
non-numeric argument to mathematical function
Error:
Error in FUN : invalid ‘type’ (character) of argument
Error:
no applicable method
- caused by using an object-oriented function on a data type it does not supportError:
number of items to replace is not a multiple of ## replacement length
Error:
unexpected numeric constant
Error:
condition has length > 1
Error:
$ operator is invalid for atomic vectors
Error:
unimplemented type ‘list’
Error:
replacement has length zero
Error:
argument is of length zero
Error:
incorrect number of subscripts on matrix
Error:
subscript out of bounds
Error:
incorrect number of dimensions
Error:
replacement has x rows, data has y
Error:
arguments imply differing number of rows
Error:
missing values are not allowed in subscripted assignments of data frames
Error:
Object of Type ‘Closure’ is not Subsettable
4.2 Built-in Exceptions
For a list of Python errors, check the official built-in exceptions documentation.