Biology Reference
In-Depth Information
Functions to produce nicely formatted plots such as boxplots, histograms, and
scatterplots
Statistical models such as linear and generalized linear models as well as func-
tions for statistical hypothesis testing
Several reference data sets from literature
Utilities to import and export data in various formats (e.g., space- and tab-
separated text; comma-separated values (CSV); files saves from other statistical
software such as STATA, SPSS, and Octave; and many more).
Contributed packages are implemented by independent developers and then sub-
mitted to CRAN, which provides a unified distribution network and basic quality
checking. In recent years it has become increasingly common to provide reference
implementations of new methodologies as R packages. This trend has improved the
reproducibility of scientific results presented in literature and, at the same time, has
increased dramatically the number of fields in which R is a valuable data analysis
tool.
1.2.2 A Quick Introduction to R
We will now illustrate some basic R commands for importing, exploring, summariz-
ing, and plotting data. For this purpose, we will use the lizards data set included
in the bnlearn package because of its simple structure. This data set was origi-
nally published in Schoener ( 1968 ) and has been used by Fienberg ( 1980 )andmore
recently by Edwards ( 2000 ) as an example in the respective topics.
First of all, we need to install the bnlearn package from one of the mirrors of the
CRAN network. After launching R , we can type the following command after the
> ”prompt:
> install.packages("bnlearn")
An up-to-date list of mirrors to choose from will be displayed as either a pop-up
window or a text prompt. Once bnlearn has been installed, it can be loaded with
> library(bnlearn)
Clearly, install.package needs to be called only once for any given package,
while loading the package with library is required at every new R session even
when the workspace of the last session has been restored at start-up.
The lizards data set can then be loaded from bnlearn with
> data(lizards)
since the package is now loaded in the R session. If the data were stored in a text file,
we could have imported them into R using the read.table function as follows:
> lizards = read.table("lizards.txt", header = TRUE)
Search WWH ::




Custom Search