R for Spatial Statistics


Getting Help

Finding Help

Finding the function you need in R can be quite a challenge. My advice is to search on the web for the method you want a function for an include "R" in the search. This will typically send you to a blog or listserv where someone has worked with the method you're interested in. Example searches could be:

linear regression R
histogram R
gam R

All of these will lead you to web pages that will include the functions you need. You can search for the function on the web by entering "FunctoinName R" in to a search engine. Enter the following into a search engine and you'll probably see the "CRAN" page for the function. CRAN stands for "Comprehensive R Archive Network" and contains most of the libraries you'll use in R. If you scroll down this page you'll find a "pdf" document with the information you need on the function.

seq R 

You should see a PDF file that is in the standard "R" format. This is not the easiest format to understand but it is very standard with R. Between these pages, other information from the web, and a few books, you'll be an R master in no time.

Take a look at this page and you should see a full definition of the function, a description of all the possible arguments (parameters), details on the function's operation, and a set of examples at the bottom of the page. There may also be other information.

The function definition and description of the parameters is critical to using the function. Arguments that do not have an equals sign ("=") are required and specified in the order shown in the PDF. The other parameters are optional and can either be specified in the order shown or with the name in front of the equals and then with a value based on the name of the parameter. This makes specifying arguments for functions very flexible.

Below are some calls to "seq". Try these and then try creating some sequences of your own until you are comfortable with the function and the documentation.

s4 = seq(length=51, from=-5, by=.2) 

Help in the R Console

You can also get help in the R Console but I do not find this as helpful as the web.

Once you have the function name, you can type "?FunctionName" into the R Console to see the help page displayed in the Help panel in the lower right. Try the following in the R Console:


The pages can be a little hard to read as they are shown in a sub-panel. You can also type "help()" into the R Console to bring up help on the help function but again, I don't find this very useful.

help() #opens the help for help which is not very helpful