Both beginning and experienced R programmers make these common mistakes. When you run your program, and it generates an errors, first check the following errors before you waste additional time troubleshooting the error:
- Using the wrong case—help(), Help(), and HELP() are three different functions (only the help() will work). Test
- Forgetting to use quotation marks when they’re needed—install.packages-(“gclus”) works, whereas install.packages(gclus) generates an error.
- Forgetting to include the parentheses in a function call— For example, help() works, but help doesn’t. Even if there are no options, you still need the ()
- Using the \ in a pathname on Windows— R sees the backslash character as an escape character. setwd(“c:\mydata”) generates an error. Use setwd(“c:/mydata”) or setwd(“c:\\mydata”) instead.
- Using a function from a package that’s not loaded— The function order.clusters() is contained in the gclus package. If you try to use it before loading the package, you’ll get an error.
Leave A Comment