Biology Reference
In-Depth Information
finer points of
R
programming, such as performance tuning and integrating com-
piled code, should also check “S Programming” by
Venables and Ripley
(
2000
).
Exercises
1.1.
Consider a directed acyclic graph with
n
nodes.
(a) Show that at least one node must not have any incoming arc, i.e., the graph must
contain at least one root node.
(b) Show that such a graph can have at most
1
2
n
(
n
−
1
)
arcs.
(c) Show that a path can span at most
n
1arcs.
(d) Describe an algorithm to determine the topological ordering of the graph.
−
1.2.
Consider the graphs shown in Fig.
1.1
.
(a) Obtain the skeleton of the partially directed and directed graphs.
(b) Enumerate the acyclic graphs that can be obtained by orienting the undirected
arcs of the partially directed graph.
(c) List the arcs that can be reversed (i.e., turned in the opposite direction), one at a
time, without introducing cycles in the directed graph.
1.3.
The (famous)
iris
data set reports the measurements in centimeters of the
sepal length and width and the petal length and width for 50 flowers from each of 3
species of iris (“setosa,” “versicolor,” and “virginica”).
(a) Load the
iris
data set (it is included in the
datasets
package, which is part of
the base
R
distribution and does not need to be loaded explicitly) and read its
manual page.
(b) Investigate the structure of the data set.
(c) Compare the sepal length among the three species by plotting histograms side
by side.
(d) Repeat the previous point using boxplots.
1.4.
Consider again the
iris
data set from Exercise
1.3
.
(a) Write the data frame holding
iris
data frame into a space-separated text file
named “iris.txt,” and read it back into a second data frame called
iris2
.
(b) Check that
iris
and
iris2
are identical.
(c) Repeat the previous two steps with a file compressed with
bzip2
named
“iris.txt.bz2.”
(d) Save
iris
directly (e.g., without converting it to a text table) into a file called
“iris.rda,” and read it back.
(e) List all
R
objects in the global environment and remove all of them apart from
iris
.
(f) Exit the
R
saving the contents of the current session.
1.5.
Consider the
gaussian.test
data set included in
bnlearn
.
Search WWH ::
Custom Search