Skip to content
Prev 65665 / 398506 Next

plotting

On Wed, 2005-03-09 at 14:28 -0400, Owen Buchner wrote:
If you are using R's base graphics and you want 9 plots arranged
vertically, you can use par(mfrow = 9) before your first plot.

The first plot will then be in the top panel (row).

Each successive call to a high level plot function [ie. plot(), boxplot
(), barplot()] will draw the plot in the next panel (row) down.

See ?par for more information and some examples.

Another option, for base graphics, is to use the layout() function and
yet another, is to use the grid/lattice packages for creating "Trellis"
type plots.
If you want to generate random numbers from a pre-specified sequence of
numbers between some min and max values (each number having an equal
probability of being selected) and then return one of them, you can use
the sample function:

  sample(min:max, 1)

See ?sample for more information. Note that the sequence need not be all
integers:
[1] 2.5


If you want the random numbers to be within some min:max set of limits,
such that:

  min <= x <= max

each 'x' having an equal probability of being selected and then return
one of the numbers, use runif():

  runif(1, min, max)

See ?runif for more information.

HTH,

Marc Schwartz