| Error message | How to fix it |
|---|---|
|
You have either mis-typed the package name or the package is not installed. Check the spelling or use |
`could not find function |
You have either mis-typed the function name or the package containing that function is not loaded. Check the spelling or use |
|
You have either mis-typed the name of the object or the object does not exist. Check the spelling and make sure you have run the code that creates the object. This error can also occur when you have forgotten to put quotes around a character value in an argument, since R treats words without quotes around them as the names of objects. In this case, check that you have used quote marks around any character values in your code. |
|
You have either mis-typed the name of a file that R is trying to access or the file does not exist in the location you have specified. Check the spelling and make sure the file exists. |
|
You have tried to use a mathematical operator such as |
|
You have tried to use a function as if it is an object, which can happen when you store data in an object that has the same name as an R function (most commonly, when you store some data in an object called |
|
Some R functions (called generic functions) work in different ways depending on what type of object you use them on. But if you use a generic function on an object that it does not know how to handle, you will see this error. Check the object(s) that you provided to the function causing the error to make sure it is the type of object you are expecting it to be. |
`unexpected numeric constant in |
You have a typo somewhere in your code. Check the line of code producing the error to make sure it is formatted correctly. The most common typos that cause this error are a missing comma or closing parenthesis, but there are several other typos that can cause similar errors. |
`unused argument (var = |
You have used an argument name in a function that does not understand it. Check the manual page for that function. |
`argument |
You have used a function without providing all the necessary arguments. Check the manual page for that function. |
|
There is a pipe operator at the end of the final line of a code pipeline (or what R thinks should be the final line), or you have omitted the parentheses at the end of a function name. |
Appendix B — Common R errors and how to fix them
In these error messages, the code blah represents the function, object or value that the error relates to.