The most common syntax errors will be lack of matching parentheses, brackets, braces, or quotation marks. When you encounter a syntax error, this is the first thing you should check and double-check. I highly recommend that you use a text editor that does parentheses matching and syntax coloring for R, such as Vim or Emacs.
You may sometimes get messages like the following:
There were 50 or more warnings (use warnings() to see the first 50)
These should be heeded—run warnings()
as suggested. The problem could range from nonconvergence of an algorithm to misspecification of a matrix argument to a function. In many cases, the program output may be invalid, though it may well be fine, too, say with this message:
Fitted probabilities numerically 0 or 1 occurred in: glm...
In some cases, you may find it useful to issue this command:
> options(warn=2)
This instructs R to turn warnings into actual errors and makes the locations of the warnings easier to find.