bjg@network-theory.co.uk
2004-Aug-23 14:45 UTC
[Rd] corrections for R-intro.texi (PR#7192)
Hello, Here are some patches for R-intro.texi, to correct various typos, missing words, and minor inconsistencies in formatting. Each patch is preceeded by its corresponding 'wdiff' output to make it easier to see which words have changed. -- Brian Gough Network Theory Ltd, Publishing the R Reference Manuals --- http://www.network-theory.co.uk/R/ ===================================================================== {+the+} ===================================================================== [-pch="+",xlab="x",-] {+pch="+", xlab="x",+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:43 2004 +++ R-intro.texi Mon Aug 23 13:23:43 2004 @@ -6026,7 +6026,7 @@ the reduction factor is 0.66. @item mfg=c(2, 2, 3, 2) -Position of current figure in a multiple figure environment. The first +Position of the current figure in a multiple figure environment. The first two numbers are the row and column of the current figure; the last two are the number of rows and columns in the multiple figure array. Set this parameter to jump between figures in the array. You can even use @@ -6574,7 +6574,7 @@ @item w <- ifelse(Mod(w) > 1, 1/w, w) @dots{} and to map any outside the circle onto their reciprocal. -@item plot(w, xlim=c(-1,1), ylim=c(-1,1), pch="+",xlab="x", ylab="y") +@item plot(w, xlim=c(-1,1), ylim=c(-1,1), pch="+", xlab="x", ylab="y") @itemx lines(z) @itemx All points are inside the unit circle, but the distribution is not ===================================================================== {+the+} ===================================================================== {+a+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:43 2004 +++ R-intro.texi Mon Aug 23 13:23:43 2004 @@ -6010,7 +6010,7 @@ @table @code @item mfcol=c(3, 2) @itemx mfrow=c(2, 4) -Set size of multiple figure array. The first value is the number of +Set the size of a multiple figure array. The first value is the number of rows; the second is the number of columns. The only difference between these two parameters is that setting @code{mfcol} causes figures to be filled by column; @code{mfrow} fills by rows. ===================================================================== [-least.)-] {+least).+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:44 2004 +++ R-intro.texi Mon Aug 23 13:23:44 2004 @@ -5952,7 +5952,7 @@ Setting this parameter to @code{"d"} (direct axis) @emph{locks in} the current axis and uses it for all future plots (or until the parameter is -set to one of the other values above, at least.) Useful for generating +set to one of the other values above, at least). Useful for generating series of fixed-scale plots. @end table ===================================================================== [-x1+x2,-] {+x1 + x2,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:44 2004 +++ R-intro.texi Mon Aug 23 13:23:44 2004 @@ -4766,7 +4766,7 @@ achieves the same result as @example -> fm <- lm(y ~ x1+x2, data=sales) +> fm <- lm(y ~ x1 + x2, data=sales) @end example @noindent ===================================================================== [-but-] {+(but+} ===================================================================== [-optional-] {+optional)+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:44 2004 +++ R-intro.texi Mon Aug 23 13:23:44 2004 @@ -4383,7 +4383,7 @@ would fit a multiple regression model of @math{y} on @math{x1} and @math{x2} (with implicit intercept term). -The important but technically optional parameter @code{data +The important (but technically optional) parameter @code{data production} specifies that any variables needed to construct the model should come first from the @code{production} @emph{data frame}. @emph{This is the case regardless of whether data frame ===================================================================== {+the+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:45 2004 +++ R-intro.texi Mon Aug 23 13:23:45 2004 @@ -3967,7 +3967,7 @@ The location of the site initialization file is taken from the value of the @env{R_PROFILE} environment variable. If that variable is unset, -file @file{Rprofile.site} in the @R{} home subdirectory @file{etc} is +the file @file{Rprofile.site} in the @R{} home subdirectory @file{etc} is used. This file should contain the commands that you want to execute every time @R{} is started under your system. A second, personal, profile file named @file{.Rprofile}@footnote{So it is hidden under ===================================================================== [-(it-] {+(if it+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:46 2004 +++ R-intro.texi Mon Aug 23 13:23:46 2004 @@ -3090,7 +3090,7 @@ @end example @noindent -which will usually (it is a random sample) show longer tails than +which will usually (if it is a random sample) show longer tails than expected for a normal. We can make a Q-Q plot against the generating distribution by ===================================================================== [-Standard-] {+The standard+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:46 2004 +++ R-intro.texi Mon Aug 23 13:23:46 2004 @@ -3100,7 +3100,7 @@ @end example Finally, we might want a more formal test of agreement with normality -(or not). Standard package @pkg{stats} provides the Shapiro-Wilk test +(or not). The standard package @pkg{stats} provides the Shapiro-Wilk test @cindex Shapiro-Wilk test @findex shapiro.test ===================================================================== {+>+} ===================================================================== {+>+} ===================================================================== {+>+} ===================================================================== {+>+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:46 2004 +++ R-intro.texi Mon Aug 23 13:23:46 2004 @@ -3071,8 +3071,8 @@ @findex qqline @example -par(pty="s") -qqnorm(long); qqline(long) +> par(pty="s") +> qqnorm(long); qqline(long) @end example @noindent @@ -3085,8 +3085,8 @@ @end iftex @example -x <- rt(250, df = 5) -qqnorm(x); qqline(x) +> x <- rt(250, df = 5) +> qqnorm(x); qqline(x) @end example @noindent ===================================================================== {+the+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:46 2004 +++ R-intro.texi Mon Aug 23 13:23:46 2004 @@ -3040,7 +3040,7 @@ @image{images/hist,9cm} @end iftex -We can plot the empirical cumulative distribution function by using +We can plot the empirical cumulative distribution function by using the function @code{ecdf} in the standard package @pkg{stepfun}. @findex ecdf @cindex Empirical CDFs ===================================================================== {+are+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:47 2004 +++ R-intro.texi Mon Aug 23 13:23:47 2004 @@ -1755,7 +1755,7 @@ > dim(Z) <- c(3,4,2) @end example -However if @code{h} is shorter than 24, its values recycled from the +However if @code{h} is shorter than 24, its values are recycled from the beginning again to make it up to size 24 (@pxref{The recycling rule}). As an extreme but common example ===================================================================== [-input. (See-] {+input (see+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:47 2004 +++ R-intro.texi Mon Aug 23 13:23:47 2004 @@ -1296,7 +1296,7 @@ mode of the object in the first place. This automatic adjustment of lengths of an object is used often, for -example in the @code{scan()} function for input. (See @ref{The scan() +example in the @code{scan()} function for input (see @ref{The scan() function}.) Conversely to truncate the size of an object requires only an assignment ===================================================================== [-no-] {+not+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:47 2004 +++ R-intro.texi Mon Aug 23 13:23:47 2004 @@ -1058,7 +1058,7 @@ @noindent selects the first 10 elements of @code{x} (assuming @code{length(x)} is -no less than 10). Also +not less than 10). Also @example > c("x","y")[rep(c(1,2,2,1), times=4)] ===================================================================== [-allows to collapse-] {+joins+} ===================================================================== [-string-] {+string,+} ===================================================================== [-between, and there-] {+between. There+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:47 2004 +++ R-intro.texi Mon Aug 23 13:23:47 2004 @@ -999,9 +999,9 @@ Note particularly that recycling of short lists takes place here too; thus @code{c("X", "Y")} is repeated 5 times to match the sequence @code{1:10}. -@footnote{@code{paste(..., collapse=@var{ss})} allows to collapse the -arguments into a single character string putting @var{ss} in between, and -there are more tools for character manipulation, see the help +@footnote{@code{paste(..., collapse=@var{ss})} joins the +arguments into a single character string, putting @var{ss} in between. +There are more tools for character manipulation, see the help for @code{sub} and @code{substring}.} @node Index vectors, Other types of objects, Character vectors, Simple manipulations numbers and vectors ===================================================================== {+are+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:47 2004 +++ R-intro.texi Mon Aug 23 13:23:48 2004 @@ -1022,7 +1022,7 @@ @strong{A logical vector}. In this case the index vector must be of the same length as the vector from which elements are to be selected. Values corresponding to @code{TRUE} in the index vector are selected and -those corresponding to @code{FALSE} omitted. For example +those corresponding to @code{FALSE} are omitted. For example @example > y <- x[!is.na(x)] ===================================================================== [-vectors-] {+vector+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:48 2004 +++ R-intro.texi Mon Aug 23 13:23:48 2004 @@ -853,7 +853,7 @@ @section Logical vectors As well as numerical vectors, @R{} allows manipulation of logical -quantities. The elements of a logical vectors can have the values +quantities. The elements of a logical vector can have the values @code{TRUE}, @code{FALSE}, and @code{NA} (for ``not available'', see below). The first two are often abbreviated as @code{T} and @code{F}, respectively. Note however that @code{T} and @code{F} are just ===================================================================== [-in-] =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:48 2004 +++ R-intro.texi Mon Aug 23 13:23:48 2004 @@ -2760,7 +2760,7 @@ @section The @code{scan()} function @findex scan -Suppose the data vectors are of equal length and are to be read in in +Suppose the data vectors are of equal length and are to be read in parallel. Further suppose that there are three vectors, the first of mode character and the remaining two of mode numeric, and the file is @file{input.dat}. The first step is to use @code{scan()} to read in the ===================================================================== [-the-] =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:48 2004 +++ R-intro.texi Mon Aug 23 13:23:48 2004 @@ -1045,7 +1045,7 @@ @item @strong{A vector of positive integral quantities}. In this case the -values in the index vector must lie in the the set @{1, 2, @dots{}, +values in the index vector must lie in the set @{1, 2, @dots{}, @code{length(x)}@}. The corresponding elements of the vector are selected and concatenated, @emph{in that order}, in the result. The index vector can be of any length and the result is of the same length ===================================================================== [-modelling,-] {+modeling,+} ===================================================================== [-colours-] {+colors+} ===================================================================== [-Unix-alikes-] {+Unix-like systems+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:48 2004 +++ R-intro.texi Mon Aug 23 13:23:48 2004 @@ -93,7 +93,7 @@ statistical computing and graphics. R is similar to the award-winning S system, which was developed at Bell Laboratories by John Chambers et al. It provides a wide variety of statistical and graphical techniques -(linear and nonlinear modelling, statistical tests, time series +(linear and nonlinear modeling, statistical tests, time series analysis, classification, clustering, ...). This manual provides information on data types, programming elements, @@ -5427,7 +5427,7 @@ @findex contour @findex persp Plots of three variables. The @code{image} plot draws a grid of rectangles -using different colours to represent the value of @code{z}, the @code{contour} +using different colors to represent the value of @code{z}, the @code{contour} plot draws contour lines to represent the value of @code{z}, and the @code{persp} plot draws a 3D surface. @end table @@ -6084,7 +6084,7 @@ @table @code @item X11() @findex X11 -For use with the X11 window system on Unix-alikes +For use with the X11 window system on Unix-like systems @item windows() @findex windows For use on Windows ===================================================================== {+the+} ===================================================================== {+the+} ===================================================================== {+the+} ===================================================================== [-command,-] {+the command line,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:49 2004 +++ R-intro.texi Mon Aug 23 13:23:49 2004 @@ -7027,9 +7027,9 @@ @item C-d Delete the character under the cursor. @item M-d -Delete rest of the word under the cursor, and ``save'' it. +Delete the rest of the word under the cursor, and ``save'' it. @item C-k -Delete from cursor to end of command, and ``save'' it. +Delete from the cursor to the end of the command line, and ``save'' it. @item C-y Insert (yank) the last ``saved'' text here. @item C-t ===================================================================== {+the+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:49 2004 +++ R-intro.texi Mon Aug 23 13:23:49 2004 @@ -7021,7 +7021,7 @@ @item @var{text} Insert @var{text} at the cursor. @item C-f @var{text} -Append @var{text} after cursor. +Append @var{text} after the cursor. @item @key{DEL} Delete the previous character (left of the cursor). @item C-d ===================================================================== {+the+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:50 2004 +++ R-intro.texi Mon Aug 23 13:23:50 2004 @@ -6931,7 +6931,7 @@ When the @acronym{GNU} @strong{readline} library is available at the time @R{} is configured for compilation under UNIX, an inbuilt command line editor allowing recall, editing and re-submission of prior commands -is used. Note: this appendix does @strong{not} apply to @acronym{GNOME} +is used. Note: this appendix does @strong{not} apply to the @acronym{GNOME} interface under UNIX, only to the standard command-line interface. It can be disabled (useful for usage with @acronym{ESS}@footnote{The ===================================================================== [-plot, if-] {+plot. If+} ===================================================================== [-produce-] {+produces+} ===================================================================== [-vector, and if-] {+vector. If+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:50 2004 +++ R-intro.texi Mon Aug 23 13:23:50 2004 @@ -5297,9 +5297,9 @@ containing two elements @var{x} and @var{y} or a two-column matrix. @item plot(@var{x}) -If @var{x} is a time series, this produces a time-series plot, if -@var{x} is a numeric vector, it produce a plot of the values in the -vector against their index in the vector, and if @var{x} is a complex +If @var{x} is a time series, this produces a time-series plot. If +@var{x} is a numeric vector, it produces a plot of the values in the +vector against their index in the vector. If @var{x} is a complex vector, it produces a plot of imaginary versus real parts of the vector elements. ===================================================================== [-Fitting, for-] {+For+} ===================================================================== {+fitting a+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:50 2004 +++ R-intro.texi Mon Aug 23 13:23:50 2004 @@ -4356,9 +4356,9 @@ Although the details are complicated, model formulae in @R{} will normally generate the models that an expert statistician would expect, -provided that marginality is preserved. Fitting, for example, model with -interaction but not the corresponding main effects will in general lead -to surprising results, and is for experts only. +provided that marginality is preserved. For example, fitting a model +with interaction but not the corresponding main effects will in general +lead to surprising results, and is for experts only. @node Linear models, Generic functions for extracting model information, Formulae for statistical models, Statistical models in R ===================================================================== [-than-] {+then+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:50 2004 +++ R-intro.texi Mon Aug 23 13:23:50 2004 @@ -3975,7 +3975,7 @@ directory then that file will be sourced. This file gives individual users control over their workspace and allows for different startup procedures in different working directories. If no @file{.Rprofile} -file is found in the startup directory, than @R{} looks for a +file is found in the startup directory, then @R{} looks for a @file{.Rprofile} file in the user's home directory and uses that (if it exists). ===================================================================== [-in the example below.-] {+below:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:51 2004 +++ R-intro.texi Mon Aug 23 13:23:51 2004 @@ -3653,7 +3653,7 @@ graphical output. (@xref{The par() function}, for more details on the @code{par()} function.) This can be done by including an extra argument, literally @samp{@dots{}}, of the function, which may then be -passed on. An outline example is given in the example below. +passed on. An outline example is given below: @example fun1 <- function(data, data.frame, graph=TRUE, limit=20, ...) @{ ===================================================================== {+as+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:51 2004 +++ R-intro.texi Mon Aug 23 13:23:51 2004 @@ -2686,7 +2686,7 @@ in the data frame. @item -Each additional line of the file has its first item a @emph{row label} +Each additional line of the file has as its first item a @emph{row label} and the values for each variable. @end itemize ===================================================================== [-However-] {+@noindent However,+} ===================================================================== {+@noindent+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:51 2004 +++ R-intro.texi Mon Aug 23 13:23:51 2004 @@ -2531,8 +2531,8 @@ @example > lentils$u <- v+w @end example - -However the new value of component @code{u} is not visible until the +@noindent +However, the new value of component @code{u} is not visible until the data frame is detached and attached again. To detach a data frame, use the function @@ -2540,7 +2540,7 @@ @example > detach() @end example - +@noindent More precisely, this statement detaches from the search path the entity currently at @w{position 2}. Thus in the present context the variables @code{u}, @code{v} and @code{w} would be no longer visible, except under ===================================================================== [-@code{1}s-] {+ones+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:51 2004 +++ R-intro.texi Mon Aug 23 13:23:52 2004 @@ -2203,7 +2203,7 @@ Suppose @code{X1} and @code{X2} have the same number of rows. To combine these by columns into a matrix @code{X}, together with an -initial column of @code{1}s we can use +initial column of ones we can use @example > X <- cbind(1, X1, X2) ===================================================================== [-argument, possibly-] {+arguments (possibly+} ===================================================================== [-extended,-] {+extended)+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:52 2004 +++ R-intro.texi Mon Aug 23 13:23:52 2004 @@ -2198,7 +2198,7 @@ of the longest vector if no matrices are given). The function @code{rbind()} does the corresponding operation for rows. -In this case any vector argument, possibly cyclically extended, are of +In this case any vector arguments (possibly cyclically extended) are of course taken as row vectors. Suppose @code{X1} and @code{X2} have the same number of rows. To ===================================================================== [-0s.-] {+zero.+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:52 2004 +++ R-intro.texi Mon Aug 23 13:23:52 2004 @@ -1665,7 +1665,7 @@ Extract elements @code{X[1,3]}, @code{X[2,2]} and @code{X[3,1]} as a vector structure, and @item -Replace these entries in the array @code{X} by 0s. +Replace these entries in the array @code{X} by zero. @end itemize In this case we need a @math{3} by @math{2} subscript array, as in the following example. ===================================================================== {+a specific example.+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:52 2004 +++ R-intro.texi Mon Aug 23 13:23:52 2004 @@ -1386,7 +1386,7 @@ classification (grouping) of the components of other vectors of the same length. @R{} provides both @emph{ordered} and @emph{unordered} factors. While the ``real'' application of factors is with model formulae -(@pxref{Contrasts}), we here look at +(@pxref{Contrasts}), we here look at a specific example. @section A specific example ===================================================================== {+@noindent+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:53 2004 +++ R-intro.texi Mon Aug 23 13:23:53 2004 @@ -372,7 +372,7 @@ > help(solve) @end example @findex help - +@noindent An alternative is @example ===================================================================== [-Tree based-] {+Tree-based+} ===================================================================== [-@strong{Tree based-] {+@strong{Tree-based+} ===================================================================== [-tree based-] {+tree-based+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:53 2004 +++ R-intro.texi Mon Aug 23 13:23:53 2004 @@ -5187,9 +5187,9 @@ @c newer functions. @item -@cindex Tree based models -@strong{Tree based models.} Rather than seek an explicit global linear -model for prediction or interpretation, tree based models seek to +@cindex Tree-based models +@strong{Tree-based models.} Rather than seek an explicit global linear +model for prediction or interpretation, tree-based models seek to bifurcate the data, recursively, at critical points of the determining variables in order to partition the data ultimately into groups that are as homogeneous as possible within, and as heterogeneous as possible ===================================================================== [-low level-] {+low-level+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:53 2004 +++ R-intro.texi Mon Aug 23 13:23:53 2004 @@ -2163,7 +2163,7 @@ It is not assumed that @code{X} has full column rank. Redundancies will be discovered and removed as they are found. -This alternative is the older, low level way to perform least squares +This alternative is the older, low-level way to perform least squares calculations. Although still useful in some contexts, it would now generally be replaced by the statistical models features, as will be discussed in @ref{Statistical models in R}. ===================================================================== [-(top level)-] {+(top-level)+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:53 2004 +++ R-intro.texi Mon Aug 23 13:23:53 2004 @@ -2329,7 +2329,7 @@ its first entry. If @code{Lst} is a list, then the function @code{length(Lst)} gives the -number of (top level) components it has. +number of (top-level) components it has. Components of lists may also be @emph{named}, and in this case the component may be referred to either by giving the component name as a ===================================================================== [-two way-] {+two-way+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:54 2004 +++ R-intro.texi Mon Aug 23 13:23:54 2004 @@ -2248,7 +2248,7 @@ @cindex Tabulation Recall that a factor defines a partition into groups. Similarly a pair -of factors defines a two way cross classification, and so on. +of factors defines a two-way cross classification, and so on. @findex table The function @code{table()} allows frequency tables to be calculated from equal length factors. If there are @math{k} category arguments, ===================================================================== [-element by element-] {+element-by-element+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:54 2004 +++ R-intro.texi Mon Aug 23 13:23:54 2004 @@ -1772,7 +1772,7 @@ subscript stands for the entire array as an array. Arrays may be used in arithmetic expressions and the result is an array -formed by element by element operations on the data vector. The +formed by element-by-element operations on the data vector. The @code{dim} attributes of operands generally need to be the same, and this becomes the dimension vector of the result. So if @code{A}, @code{B} and @code{C} are all similar arrays, then ===================================================================== [-one dimensional-] {+one-dimensional+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:54 2004 +++ R-intro.texi Mon Aug 23 13:23:54 2004 @@ -3790,7 +3790,7 @@ are not inherited by called functions in higher evaluation frames as they would be if they were on the search path. -The example below shows a naive way of performing one dimensional +The example below shows a naive way of performing one-dimensional numerical integration. The integrand is evaluated at the end points of the range and in the middle. If the one-panel trapezium rule answer is close enough to the two panel, then the latter is returned as the value. ===================================================================== [-plots,-] {+plots+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:55 2004 +++ R-intro.texi Mon Aug 23 13:23:55 2004 @@ -6547,7 +6547,7 @@ @item image(x, y, f) @itemx image(x, y, fa) -Make some high density image plots, (of which you can get +Make some high density image plots (of which you can get hardcopies if you wish), @dots{} @item objects(); rm(x, y, f, fa) ===================================================================== [-@math{x}-] {+@math{x},+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:55 2004 +++ R-intro.texi Mon Aug 23 13:23:55 2004 @@ -6421,7 +6421,7 @@ @item fm <- lm(y ~ x, data=dummy) @itemx summary(fm) -Fit a simple linear regression of @math{y} on @math{x} and look at the +Fit a simple linear regression of @math{y} on @math{x}, and look at the analysis. @item fm1 <- lm(y ~ x, data=dummy, weight=1/w^2) ===================================================================== [-dotchart-] {+dotchart,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:55 2004 +++ R-intro.texi Mon Aug 23 13:23:55 2004 @@ -5415,7 +5415,7 @@ @item dotchart(x, @dots{}) @findex dotchart -Constructs a dotchart of the data in @code{x}. In a dotchart the +Constructs a dotchart of the data in @code{x}. In a dotchart, the @math{y}-axis gives a labelling of the data in @code{x} and the @math{x}-axis gives its value. For example it allows easy visual selection of all data entries with values lying in specified ranges. ===================================================================== [-graphs-] {+graphs,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:56 2004 +++ R-intro.texi Mon Aug 23 13:23:56 2004 @@ -5213,7 +5213,7 @@ Graphical facilities are an important and extremely versatile component of the @R{} environment. It is possible to use the facilities to -display a wide variety of statistical graphs and also to build entirely +display a wide variety of statistical graphs, and also to build entirely new types of graph. The graphics facilities can be used in both interactive and batch modes, but in ===================================================================== [-example-] {+example,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:56 2004 +++ R-intro.texi Mon Aug 23 13:23:56 2004 @@ -4908,7 +4908,7 @@ For all families the variance of the response will depend on the mean and will have the scale parameter as a multiplier. The form of dependence of the variance on the mean is a characteristic of the -response distribution; for example for the poisson distribution +response distribution; for example, for the poisson distribution @eqn{\hbox{Var}[y] = \mu,Var(y) = mu}. For quasi-likelihood estimation and inference the precise response ===================================================================== [-families-] {+families,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:56 2004 +++ R-intro.texi Mon Aug 23 13:23:56 2004 @@ -4905,7 +4905,7 @@ @subsubheading Quasi-likelihood models -For all families the variance of the response will depend on the mean +For all families, the variance of the response will depend on the mean and will have the scale parameter as a multiplier. The form of dependence of the variance on the mean is a characteristic of the response distribution; for example, for the poisson distribution ===================================================================== [-Occasionally-] {+Occasionally,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:56 2004 +++ R-intro.texi Mon Aug 23 13:23:56 2004 @@ -4892,7 +4892,7 @@ further here. It even forms a major part of the use of non-gaussian generalized models overall. -Occasionally genuinely Poisson data arises in practice and in the past +Occasionally, genuinely Poisson data arises in practice and in the past it was often analyzed as gaussian data after either a log or a square-root transformation. As a graceful alternative to the latter, a Poisson generalized linear model may be fitted as in the following ===================================================================== [-default-] {+default,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:57 2004 +++ R-intro.texi Mon Aug 23 13:23:57 2004 @@ -4864,7 +4864,7 @@ > fml <- glm(Ymat ~ x, family = binomial, data = kalythos) @end example -Since the logit link is the default the parameter may be omitted on the +Since the logit link is the default, the parameter may be omitted on the second call. To see the results of each fit we could use @example ===================================================================== [-experiments-] {+experiments,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:57 2004 +++ R-intro.texi Mon Aug 23 13:23:57 2004 @@ -4522,7 +4522,7 @@ Hence only for orthogonal experiments will the order of inclusion be inconsequential. -For multistratum experiments the procedure is first to project the +For multistratum experiments, the procedure is first to project the response onto the error strata, again in sequence, and to fit the mean model to each projection. For further details, see Chambers & Hastie (1992). ===================================================================== [-terms-] {+terms,+} ===================================================================== {+as+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:58 2004 +++ R-intro.texi Mon Aug 23 13:23:58 2004 @@ -4114,7 +4114,7 @@ \qquad i = 1, @dots{}, n $$ @end tex -In matrix terms this would be written +In matrix terms, this would be written as @ifnottex @display ===================================================================== [-example-] {+example,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:58 2004 +++ R-intro.texi Mon Aug 23 13:23:58 2004 @@ -4051,7 +4051,7 @@ @end example Conversely the number of classes a generic function can handle can also -be quite large. For example the @code{plot()} function has a default +be quite large. For example, the @code{plot()} function has a default method and variants for objects of classes @code{"data.frame"}, @code{"density"}, @code{"factor"}, and more. A complete list can be got again by using the @code{methods()} function: ===================================================================== [-form-] {+form,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:58 2004 +++ R-intro.texi Mon Aug 23 13:23:58 2004 @@ -3743,7 +3743,7 @@ @subsection Dropping all names in a printed array For printing purposes with large matrices or arrays, it is often useful -to print them in close block form without the array names or numbers. +to print them in close block form, without the array names or numbers. Removing the @code{dimnames} attribute will not achieve this effect, but rather the array must be given a @code{dimnames} attribute consisting of empty strings. For example to print a matrix, @code{X} ===================================================================== [-temporary-] {+temporary,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:59 2004 +++ R-intro.texi Mon Aug 23 13:23:59 2004 @@ -3668,7 +3668,7 @@ @section Assignments within functions Note that @emph{any ordinary assignments done within the function are -local and temporary and are lost after exit from the function}. Thus +local and temporary, and are lost after exit from the function}. Thus the assignment @code{X <- qr(X)} does not affect the value of the argument in the calling program. ===================================================================== [-cases-] {+cases,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:23:59 2004 +++ R-intro.texi Mon Aug 23 13:23:59 2004 @@ -3613,7 +3613,7 @@ @noindent are all equivalent. -In many cases arguments can be given commonly appropriate default +In many cases, arguments can be given commonly appropriate default values, in which case they may be omitted altogether from the call when the defaults are appropriate. For example, if @code{fun1} were defined as ===================================================================== [-Thus-] {+Thus,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:00 2004 +++ R-intro.texi Mon Aug 23 13:24:00 2004 @@ -3593,7 +3593,7 @@ may begin in the unnamed, positional form, and specify named arguments after the positional arguments. -Thus if there is a function @code{fun1} defined by +Thus, if there is a function @code{fun1} defined by @example > fun1 <- function(data, data.frame, graph, limit) @{ ===================================================================== [-Furthermore-] {+Furthermore,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:00 2004 +++ R-intro.texi Mon Aug 23 13:24:00 2004 @@ -3589,7 +3589,7 @@ As first noted in @ref{Generating regular sequences}, if arguments to called functions are given in the ``@code{@var{name}=@var{object}}'' -form, they may be given in any order. Furthermore the argument sequence +form, they may be given in any order. Furthermore, the argument sequence may begin in the unnamed, positional form, and specify named arguments after the positional arguments. ===================================================================== [-created-] {+created,+} ===================================================================== [-permanent, like all objects,-] {+permanent+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:01 2004 +++ R-intro.texi Mon Aug 23 13:24:01 2004 @@ -3534,8 +3534,8 @@ @} @end example -After this object is created it is permanent, like all objects, and may -be used in statements such as +After this object is created, it is permanent and may be used in +statements such as @example > regcoeff <- bslash(Xmat, yvar) ===================================================================== [-default-] {+default,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:01 2004 +++ R-intro.texi Mon Aug 23 13:24:01 2004 @@ -3199,7 +3199,7 @@ @noindent which does indicate a significant difference, assuming normality. By -default the @R{} function does not assume equality of variances in the +default, the @R{} function does not assume equality of variances in the two samples (in contrast to the similar @SPLUS{} @code{t.test} function). We can use the F test to test for equality in the variances, provided that the two samples are from normal populations. ===================================================================== [-samples.-] {+samples,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:02 2004 +++ R-intro.texi Mon Aug 23 13:24:02 2004 @@ -3152,7 +3152,7 @@ @end example @noindent -Boxplots provide a simple graphical comparison of the two samples. +Boxplots provide a simple graphical comparison of the two samples, @c NOTE scan() from stdin is not parse()able, hence not source()able @c Hence ./R-intro.R uses c(..) ===================================================================== [-test-] {+test,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:02 2004 +++ R-intro.texi Mon Aug 23 13:24:02 2004 @@ -3114,7 +3114,7 @@ @end example @noindent -and the Kolmogorov-Smirnov test +and the Kolmogorov-Smirnov test, @cindex Kolmogorov-Smirnov test @findex ks.test ===================================================================== [-data-] {+data,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:03 2004 +++ R-intro.texi Mon Aug 23 13:24:03 2004 @@ -2974,7 +2974,7 @@ @node Examining the distribution of a set of data, One- and two-sample tests, R as a set of statistical tables, Probability distributions @section Examining the distribution of a set of data -Given a (univariate) set of data we can examine its distribution in a +Given a (univariate) set of data, we can examine its distribution in a large number of ways. The simplest is to examine the numbers. Two slightly different summaries are given by @code{summary} and @code{fivenum} ===================================================================== [-addition-] {+addition,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:03 2004 +++ R-intro.texi Mon Aug 23 13:24:03 2004 @@ -2958,7 +2958,7 @@ or more accurate log-likelihoods (by @code{d@var{xxx}(..., log TRUE)}), directly. -In addition there are functions @code{ptukey} and @code{qtukey} for the +In addition, there are functions @code{ptukey} and @code{qtukey} for the distribution of the studentized range of samples from a normal distribution. ===================================================================== [-example-] {+example,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:03 2004 +++ R-intro.texi Mon Aug 23 13:24:04 2004 @@ -2780,7 +2780,7 @@ @end example More conveniently, the dummy list can have named components, in which -case the names can be used to access the vectors read in. For example +case the names can be used to access the vectors read in. For example, @example > inp <- scan("input.dat", list(id="", x=0, y=0)) ===================================================================== [-Initially-] {+Initially,+} ===================================================================== [-gives-] {+shows the default path+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:04 2004 +++ R-intro.texi Mon Aug 23 13:24:04 2004 @@ -2613,7 +2613,8 @@ The function @code{search} shows the current search path and so is a very useful way to keep track of which data frames and lists (and -packages) have been attached and detached. Initially it gives +packages) have been attached and detached. Initially, it shows the +default path @example > search() ===================================================================== [-objects-] {+objects,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:04 2004 +++ R-intro.texi Mon Aug 23 13:24:04 2004 @@ -2308,7 +2308,7 @@ @cindex Lists An @R{} @emph{list} is an object consisting of an ordered collection of -objects known as its @emph{components}. +objects, known as its @emph{components}. There is no particular need for the components to be of the same mode or type, and, for example, a list could consist of a numeric vector, a ===================================================================== [-Similarly-] {+Similarly,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:06 2004 +++ R-intro.texi Mon Aug 23 13:24:06 2004 @@ -2247,7 +2247,7 @@ @section Frequency tables from factors @cindex Tabulation -Recall that a factor defines a partition into groups. Similarly a pair +Recall that a factor defines a partition into groups. Similarly, a pair of factors defines a two-way cross classification, and so on. @findex table The function @code{table()} allows frequency tables to be calculated ===================================================================== [-array-] {+array,+} ===================================================================== {+its+} ===================================================================== {+being+} ===================================================================== [-evident-] {+given+} ===================================================================== [-However-] {+However,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:06 2004 +++ R-intro.texi Mon Aug 23 13:24:06 2004 @@ -1782,8 +1782,8 @@ @end example @noindent -makes @code{D} a similar array with data vector the result of the -evident element by element operations. However the precise rule +makes @code{D} a similar array, with its data vector being the result of +the given element by element operations. However, the precise rule concerning mixed array and vector calculations has to be considered a little more carefully. ===================================================================== [-again-] {+again,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:06 2004 +++ R-intro.texi Mon Aug 23 13:24:06 2004 @@ -1756,7 +1756,7 @@ @end example However if @code{h} is shorter than 24, its values are recycled from the -beginning again to make it up to size 24 (@pxref{The recycling rule}). +beginning again, to make it up to size 24 (@pxref{The recycling rule}). As an extreme but common example @example ===================================================================== [-example-] {+example,+} ===================================================================== [-array, say-] {+array+} ===================================================================== [-@code{a}-] {+@code{a},+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:06 2004 +++ R-intro.texi Mon Aug 23 13:24:06 2004 @@ -1600,8 +1600,8 @@ order as they would occur in FORTRAN, that is ``column major order,'' with the first subscript moving fastest and the last subscript slowest. -For example if the dimension vector for an array, say @code{a} is -@code{c(3,4,2)} then there are @math{3 * 4 * 2 = 24} entries in @code{a} +For example, if the dimension vector for an array @code{a} is +@code{c(3,4,2)} then there are @math{3 * 4 * 2 = 24} entries in @code{a}, and the data vector holds them in the order @code{a[1,1,1], a[2,1,1], @dots{}, a[2,4,2], a[3,4,2]}. ===================================================================== [-factors-] {+factors,+} ===================================================================== [-purposes-] {+purposes,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:06 2004 +++ R-intro.texi Mon Aug 23 13:24:07 2004 @@ -1540,8 +1540,8 @@ Sometimes the levels will have a natural ordering that we want to record and want our statistical analysis to make use of. The @code{ordered()} @findex ordered -function creates such ordered factors but is otherwise identical to -@code{factor}. For most purposes the only difference between ordered +function creates such ordered factors, but is otherwise identical to +@code{factor}. For most purposes, the only difference between ordered and unordered factors is that the former are printed showing the ordering of the levels, but the contrasts generated for them in fitting linear models are different. ===================================================================== [-factor-] {+factor,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:07 2004 +++ R-intro.texi Mon Aug 23 13:24:07 2004 @@ -1425,7 +1425,7 @@ Levels: act nsw nt qld sa tas vic wa @end example -To find out the levels of a factor the function @code{levels()} can be +To find out the levels of a factor, the function @code{levels()} can be used. @findex levels ===================================================================== [-example-] {+example,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:07 2004 +++ R-intro.texi Mon Aug 23 13:24:07 2004 @@ -1347,7 +1347,7 @@ A special attribute known as the @emph{class} of the object is used to allow for an object oriented style of programming in @R{}. -For example if an object has class @code{"data.frame"}, it will be +For example, if an object has class @code{"data.frame"}, it will be printed in a certain way, the @code{plot()} function will display it graphically in a certain way, and other so-called generic functions such as @code{summary()} will react to it as an argument in a way sensitive ===================================================================== [-Conversely-] {+Conversely,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:07 2004 +++ R-intro.texi Mon Aug 23 13:24:07 2004 @@ -1299,7 +1299,7 @@ example in the @code{scan()} function for input (see @ref{The scan() function}.) -Conversely to truncate the size of an object requires only an assignment +Conversely, to truncate the size of an object requires only an assignment to do so. Hence if @code{alpha} is an object of length 10, then @example ===================================================================== [-so,-] {+so+} ===================================================================== [-example-] {+example,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:07 2004 +++ R-intro.texi Mon Aug 23 13:24:07 2004 @@ -1237,7 +1237,7 @@ @code{length(z)} is @code{100}. @R{} caters for changes of mode almost anywhere it could be considered -sensible to do so, (and a few where it might not be). For example with +sensible to do so (and a few where it might not be). For example, with @example > z <- 0:9 ===================================================================== [-example-] {+example,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:08 2004 +++ R-intro.texi Mon Aug 23 13:24:08 2004 @@ -1107,7 +1107,7 @@ the case of a logical index vector it must again be the same length as the vector it is indexing. -For example +For example, @example > x[is.na(x)] <- 0 ===================================================================== [-example-] {+example,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:08 2004 +++ R-intro.texi Mon Aug 23 13:24:08 2004 @@ -1049,7 +1049,7 @@ @code{length(x)}@}. The corresponding elements of the vector are selected and concatenated, @emph{in that order}, in the result. The index vector can be of any length and the result is of the same length -as the index vector. For example @code{x[6]} is the sixth component of +as the index vector. For example, @code{x[6]} is the sixth component of @code{x} and @example ===================================================================== [-case-] {+case,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:08 2004 +++ R-intro.texi Mon Aug 23 13:24:08 2004 @@ -1044,7 +1044,7 @@ non-missing and positive. @item -@strong{A vector of positive integral quantities}. In this case the +@strong{A vector of positive integral quantities}. In this case, the values in the index vector must lie in the set @{1, 2, @dots{}, @code{length(x)}@}. The corresponding elements of the vector are selected and concatenated, @emph{in that order}, in the result. The ===================================================================== [-case-] {+case,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:08 2004 +++ R-intro.texi Mon Aug 23 13:24:08 2004 @@ -1019,7 +1019,7 @@ @enumerate @item -@strong{A logical vector}. In this case the index vector must be of the +@strong{A logical vector}. In this case, the index vector must be of the same length as the vector from which elements are to be selected. Values corresponding to @code{TRUE} in the index vector are selected and those corresponding to @code{FALSE} are omitted. For example ===================================================================== [-addition-] {+addition,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:09 2004 +++ R-intro.texi Mon Aug 23 13:24:09 2004 @@ -884,7 +884,7 @@ @findex > @findex = @findex !-In addition if @code{c1} and @code{c2} are logical expressions, then +In addition, if @code{c1} and @code{c2} are logical expressions, then @w{@code{c1 & c2}} is their intersection (@emph{``and''}), @w{@code{c1 | c2}} is their union (@emph{``or''}), and @code{!c1} is the negation of @code{c1}. ===================================================================== [-example-] {+example,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:09 2004 +++ R-intro.texi Mon Aug 23 13:24:09 2004 @@ -865,7 +865,7 @@ @findex F @findex T -Logical vectors are generated by @emph{conditions}. For example +Logical vectors are generated by @emph{conditions}. For example, @example > temp <- x > 13 ===================================================================== [-Thus-] {+Thus, the expression+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:09 2004 +++ R-intro.texi Mon Aug 23 13:24:09 2004 @@ -754,7 +754,8 @@ calculations are done as double precision real numbers, or double precision complex numbers if the input data are complex. -To work with complex numbers, supply an explicit complex part. Thus +To work with complex numbers, supply an explicit complex part. Thus, +the expression @example sqrt(-17) ===================================================================== [-Internally-] {+Internally,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:09 2004 +++ R-intro.texi Mon Aug 23 13:24:09 2004 @@ -750,7 +750,7 @@ @findex pmin For most purposes the user will not be concerned if the ``numbers'' in a -numeric vector are integers, reals or even complex. Internally +numeric vector are integers, reals or even complex. Internally, calculations are done as double precision real numbers, or double precision complex numbers if the input data are complex. ===================================================================== [-particular-] {+particular,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:10 2004 +++ R-intro.texi Mon Aug 23 13:24:10 2004 @@ -673,7 +673,7 @@ longest vector which occurs in the expression. Shorter vectors in the expression are @emph{recycled} as often as need be (perhaps fractionally) until they match the length of the longest vector. In -particular a constant is simply repeated. So with the above assignments +particular, a constant is simply repeated. So with the above assignments the command @cindex Recycling rule ===================================================================== [-entries-] {+entries,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:10 2004 +++ R-intro.texi Mon Aug 23 13:24:10 2004 @@ -660,7 +660,7 @@ @end example @noindent -would create a vector @code{y} with 11 entries consisting of two copies +would create a vector @code{y} with 11 entries, consisting of two copies of @code{x} with a zero in the middle place. @node Vector arithmetic, Generating regular sequences, Vectors and assignment, Simple manipulations numbers and vectors ===================================================================== [-time-] {+time,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:11 2004 +++ R-intro.texi Mon Aug 23 13:24:11 2004 @@ -562,7 +562,7 @@ this file name makes it @emph{invisible} in normal file listings in UNIX.} in the current directory. -When @R{} is started at later time it reloads the workspace from this +When @R{} is started at later time, it reloads the workspace from this file. At the same time the associated command history is reloaded. It is recommended that you should use separate working directories for ===================================================================== [-Windows-] {+Windows,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:11 2004 +++ R-intro.texi Mon Aug 23 13:24:11 2004 @@ -506,7 +506,7 @@ @end example @findex source -For Windows @strong{Source} is also available on the +For Windows, @strong{Source} is also available on the @strong{File} menu. The function @code{sink}, @example ===================================================================== [-lines-] {+lines,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:11 2004 +++ R-intro.texi Mon Aug 23 13:24:11 2004 @@ -467,7 +467,7 @@ @end smallexample @noindent -on second and subsequent lines and continue to read input until the +on second and subsequent lines, and continue to read input until the command is syntactically complete. This prompt may be changed by the user. We will generally omit the continuation prompt and indicate continuation by simple indenting. ===================================================================== [-Normally-] {+Normally,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:11 2004 +++ R-intro.texi Mon Aug 23 13:24:11 2004 @@ -439,7 +439,7 @@ @code{A} and @code{a} are different symbols and would refer to different variables. The set of symbols which can be used in @R{} names depends on the operating system and country within which @R{} is being run -(technically on the @emph{locale} in use). Normally all alphanumeric +(technically on the @emph{locale} in use). Normally, all alphanumeric symbols are allowed (and in some countries this includes accented letters) plus @samp{@code{.}} and @samp{@code{_}}, with the restriction that a name must start with @samp{@code{.}} or a letter, and if it ===================================================================== [-sensitive}-] {+sensitive},+} ===================================================================== [-would-] =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:11 2004 +++ R-intro.texi Mon Aug 23 13:24:12 2004 @@ -435,8 +435,8 @@ @section R commands, case sensitivity, etc. Technically @R{} is an @emph{expression language} with a very simple -syntax. It is @emph{case sensitive} as are most UNIX based packages, so -@code{A} and @code{a} are different symbols and would refer to different +syntax. It is @emph{case sensitive}, as are most UNIX based packages, so +@code{A} and @code{a} are different symbols and refer to different variables. The set of symbols which can be used in @R{} names depends on the operating system and country within which @R{} is being run (technically on the @emph{locale} in use). Normally, all alphanumeric ===================================================================== [-Technically-] {+Technically,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:12 2004 +++ R-intro.texi Mon Aug 23 13:24:12 2004 @@ -434,7 +434,7 @@ @node R commands; case sensitivity etc, Recall and correction of previous commands, Getting help, Introduction and preliminaries @section R commands, case sensitivity, etc. -Technically @R{} is an @emph{expression language} with a very simple +Technically, @R{} is an @emph{expression language} with a very simple syntax. It is @emph{case sensitive}, as are most UNIX based packages, so @code{A} and @code{a} are different symbols and refer to different variables. The set of symbols which can be used in @R{} names depends ===================================================================== [-program-] {+program,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:12 2004 +++ R-intro.texi Mon Aug 23 13:24:12 2004 @@ -317,7 +317,7 @@ At this point @R{} commands may be issued (see later). @item -To quit the @R{} program the command is +To quit the @R{} program, the command is @example > q() ===================================================================== [-particular-] {+particular,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:12 2004 +++ R-intro.texi Mon Aug 23 13:24:12 2004 @@ -267,7 +267,7 @@ The most convenient way to use @R{} is at a graphics workstation running a windowing system. This guide is aimed at users who have this -facility. In particular we will occasionally refer to the use of @R{} +facility. In particular, we will occasionally refer to the use of @R{} on an X window system although the vast bulk of what is said applies generally to any implementation of the @R{} environment. ===================================================================== [-@Sl{}-] {+@Sl{},+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:13 2004 +++ R-intro.texi Mon Aug 23 13:24:13 2004 @@ -255,7 +255,7 @@ little work to find it. There is an important difference in philosophy between @Sl{} (and hence -@R{}) and the other main statistical systems. In @Sl{} a statistical +@R{}) and the other main statistical systems. In @Sl{}, a statistical analysis is normally done as a series of steps, with intermediate results being stored in objects. Thus whereas SAS and SPSS will give copious output from a regression or discriminant analysis, @R{} will ===================================================================== [-Similarly-] {+Similarly,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:13 2004 +++ R-intro.texi Mon Aug 23 13:24:13 2004 @@ -5594,7 +5594,7 @@ Where @code{x} and @code{y} arguments are required, it is also sufficient to supply a single argument being a list with elements named -@code{x} and @code{y}. Similarly a matrix with two columns is also +@code{x} and @code{y}. Similarly, a matrix with two columns is also valid input. In this way functions such as @code{locator()} (see below) may be used to specify positions on a plot interactively. ===================================================================== [-example-] {+example,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:13 2004 +++ R-intro.texi Mon Aug 23 13:24:13 2004 @@ -5419,7 +5419,7 @@ @findex dotchart Constructs a dotchart of the data in @code{x}. In a dotchart, the @math{y}-axis gives a labelling of the data in @code{x} and the -@math{x}-axis gives its value. For example it allows easy visual +@math{x}-axis gives its value. For example, it allows easy visual selection of all data entries with values lying in specified ranges. @item image(x, y, z, @dots{}) ===================================================================== [-scatterplot-] {+scatterplot,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:14 2004 +++ R-intro.texi Mon Aug 23 13:24:14 2004 @@ -5372,7 +5372,7 @@ The @code{coplot()} and @code{pairs()} function both take an argument @code{panel=} which can be used to customize the type of plot which appears in each panel. The default is @code{points()} to produce a -scatterplot but by supplying some other low-level graphics function of +scatterplot, but by supplying some other low-level graphics function of two vectors @code{x} and @code{y} as the value of @code{panel=} you can produce any type of plot you wish. An example panel function useful for coplots is @code{panel.smooth()}. ===================================================================== [-However-] {+However,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:14 2004 +++ R-intro.texi Mon Aug 23 13:24:14 2004 @@ -1720,7 +1720,7 @@ @end example @findex crossprod -However a simpler direct way of producing this matrix is to use +However, a simpler direct way of producing this matrix is to use @code{table()}: @findex table ===================================================================== [-generally-] {+generally,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:15 2004 +++ R-intro.texi Mon Aug 23 13:24:15 2004 @@ -1011,7 +1011,7 @@ Subsets of the elements of a vector may be selected by appending to the name of the vector an @emph{index vector} in square brackets. More -generally any expression that evaluates to a vector may have subsets of +generally, any expression that evaluates to a vector may have subsets of its elements similarly selected by appending an index vector in square brackets immediately after the expression. ===================================================================== [-example-] {+example,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:15 2004 +++ R-intro.texi Mon Aug 23 13:24:15 2004 @@ -984,7 +984,7 @@ @code{sep=@var{string}}, which changes it to @code{@var{string}}, possibly empty. -For example +For example, @example > labs <- paste(c("X","Y"), 1:10, sep="") ===================================================================== [-general-] {+general,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:15 2004 +++ R-intro.texi Mon Aug 23 13:24:16 2004 @@ -908,7 +908,7 @@ value'' in the statistical sense, a place within a vector may be reserved for it by assigning it the special value @code{NA}. @findex NA -In general any operation on an @code{NA} becomes an @code{NA}. The +In general, any operation on an @code{NA} becomes an @code{NA}. The motivation for this rule is simply that if the specification of an operation is incomplete, the result cannot be known and hence is not available. ===================================================================== [-example-] {+example,+} ===================================================================== [-Similarly-] {+Similarly,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:16 2004 +++ R-intro.texi Mon Aug 23 13:24:16 2004 @@ -815,7 +815,7 @@ the sequence respectively. If neither of these is given, the default @code{by=1} is assumed. -For example +For example, @example > seq(-5, 5, by=.2) -> s3 @@ -823,7 +823,7 @@ @noindent generates in @code{s3} the vector @code{c(-5.0, -4.8, -4.6, @dots{}, -4.6, 4.8, 5.0)}. Similarly +4.6, 4.8, 5.0)}. Similarly, @example > s4 <- seq(length=51, from=-5, by=.2) ===================================================================== [-on-] {+in+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:16 2004 +++ R-intro.texi Mon Aug 23 13:24:16 2004 @@ -497,7 +497,7 @@ @section Executing commands from or diverting output to a file @cindex Diverting input and output -If commands are stored on an external file, say @file{commands.R} in the +If commands are stored in an external file, say @file{commands.R} in the working directory @file{work}, they may be executed at any time in an @R{} session with the command ===================================================================== [-system-] {+system,+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:17 2004 +++ R-intro.texi Mon Aug 23 13:24:17 2004 @@ -268,7 +268,7 @@ The most convenient way to use @R{} is at a graphics workstation running a windowing system. This guide is aimed at users who have this facility. In particular, we will occasionally refer to the use of @R{} -on an X window system although the vast bulk of what is said applies +on an X window system, although the vast bulk of what is said applies generally to any implementation of the @R{} environment. Most users will find it necessary to interact directly with the ===================================================================== [-options.-] {+options:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:17 2004 +++ R-intro.texi Mon Aug 23 13:24:17 2004 @@ -6674,7 +6674,7 @@ information). Users will not normally need to use these unless they are trying to limit the amount of memory used by @R{}. -@R{} accepts the following command-line options. +@R{} accepts the following command-line options: @table @option @item --help ===================================================================== [-as-] {+as:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:18 2004 +++ R-intro.texi Mon Aug 23 13:24:18 2004 @@ -4945,7 +4945,7 @@ $\beta_2=\theta_2/\theta_1$. @end tex Supposing a suitable data frame to be set up we could fit this -non-linear regression as +non-linear regression as: @example > nlfit <- glm(y ~ x1 + x2 - 1, ===================================================================== [-below.-] {+below:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:18 2004 +++ R-intro.texi Mon Aug 23 13:24:18 2004 @@ -4406,7 +4406,7 @@ anova drop1 formula plot proj summary @end example -A brief description of the most commonly used ones is given below. +A brief description of the most commonly used ones is given below: @table @code @findex anova ===================================================================== [-errors-] {+errors:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:19 2004 +++ R-intro.texi Mon Aug 23 13:24:19 2004 @@ -4101,7 +4101,7 @@ @cindex Formulae The template for a statistical model is a linear regression model with -independent, homoscedastic errors +independent, homoscedastic errors: @ifnottex @display ===================================================================== [-is,-] {+is:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:19 2004 +++ R-intro.texi Mon Aug 23 13:24:19 2004 @@ -3988,7 +3988,7 @@ below alters the prompt to @code{$} and sets up various other useful things that can then be taken for granted in the rest of the session. -Thus, the sequence in which files are executed is, @file{Rprofile.site}, +Thus, the sequence in which files are executed is: @file{Rprofile.site}, @file{.Rprofile}, @file{.RData} and then @code{.First()}. A definition in later files will mask definitions in earlier files. ===================================================================== [-definition.-] {+definition:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:19 2004 +++ R-intro.texi Mon Aug 23 13:24:19 2004 @@ -3850,7 +3850,7 @@ of expressions in the body of the functions. Variables which are not formal parameters or local variables are called free variables. Free variables become local variables if they are assigned to. Consider the -following function definition. +following function definition: @example f <- function(x) @{ ===================================================================== [-hypothesis.-] {+hypothesis:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:20 2004 +++ R-intro.texi Mon Aug 23 13:24:20 2004 @@ -3243,7 +3243,7 @@ All these tests assume normality of the two samples. The two-sample Wilcoxon (or Mann-Whitney) test only assumes a common continuous -distribution under the null hypothesis. +distribution under the null hypothesis: @cindex Wilcoxon test @findex wilcox.test ===================================================================== [-variances.-] {+variances:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:20 2004 +++ R-intro.texi Mon Aug 23 13:24:20 2004 @@ -3224,7 +3224,7 @@ @noindent which shows no evidence of a significant difference, and so we can use -the classical @math{t}-test that assumes equality of the variances. +the classical @math{t}-test that assumes equality of the variances: @example > t.test(A, B, var.equal=TRUE) ===================================================================== [-populations.-] {+populations:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:21 2004 +++ R-intro.texi Mon Aug 23 13:24:21 2004 @@ -3204,7 +3204,7 @@ default, the @R{} function does not assume equality of variances in the two samples (in contrast to the similar @SPLUS{} @code{t.test} function). We can use the F test to test for equality in the variances, -provided that the two samples are from normal populations. +provided that the two samples are from normal populations: @example > var.test(A, B) ===================================================================== [-second.-] {+second:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:21 2004 +++ R-intro.texi Mon Aug 23 13:24:21 2004 @@ -3173,7 +3173,7 @@ @noindent which indicates that the first group tends to give higher results than -the second. +the second: @iftex @image{images/ice,7cm} ===================================================================== [-examples-] {+examples:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:21 2004 +++ R-intro.texi Mon Aug 23 13:24:21 2004 @@ -2964,7 +2964,7 @@ distribution of the studentized range of samples from a normal distribution. -Here are some examples +Here are some examples: @example > ## @r{2-tailed p-value for t distribution} ===================================================================== [-follows.-] {+follows:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:21 2004 +++ R-intro.texi Mon Aug 23 13:24:21 2004 @@ -2694,7 +2694,7 @@ If the file has one fewer item in its first line than in its second, this arrangement is presumed to be in force. So the first few lines of a file -to be read as a data frame might look as follows. +to be read as a data frame might look as follows: @quotation @cartouche ===================================================================== [-parameters.-] {+parameters:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:22 2004 +++ R-intro.texi Mon Aug 23 13:24:22 2004 @@ -5910,7 +5910,7 @@ @code{lty} graphics parameter), the @emph{tick marks} (which mark off unit divisions along the axis line) and the @emph{tick labels} (which mark the units.) These components can be customized with the following graphics -parameters. +parameters: @table @code @item lab=c(5, 7, 12) ===================================================================== [-as-] {+shown+} ===================================================================== [-table below.-] {+following table:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:22 2004 +++ R-intro.texi Mon Aug 23 13:24:22 2004 @@ -4703,7 +4703,7 @@ Each response distribution admits a variety of link functions to connect the mean with the linear predictor. Those automatically available are -as in the table below. +shown in the following table: @quotation @multitable @columnfractions 0.25 0.55 ===================================================================== [-function.-] {+function:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:22 2004 +++ R-intro.texi Mon Aug 23 13:24:22 2004 @@ -4530,7 +4530,7 @@ (1992). A more flexible alternative to the default full ANOVA table is to -compare two or more models directly using the @code{anova()} function. +compare two or more models directly using the @code{anova()} function: @findex anova @example ===================================================================== [-value.-] {+value:+} ===================================================================== [-manual.-] {+R Reference Manual.+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:22 2004 +++ R-intro.texi Mon Aug 23 13:24:22 2004 @@ -2801,14 +2801,14 @@ If the second argument is a single value and not a list, a single vector is read in, all components of which must be of the same mode as the -dummy value. +dummy value: @example > X <- matrix(scan("light.dat", 0), ncol=5, byrow=TRUE) @end example There are more elaborate input facilities available and these are -detailed in the manual. +detailed in the R Reference Manual. @node Accessing builtin datasets, Editing data, The scan() function, Reading data from files @section Accessing builtin datasets ===================================================================== [-example.-] {+example:+} =====================================================================--- R-intro.texi~ Mon Aug 23 13:24:23 2004 +++ R-intro.texi Mon Aug 23 13:24:23 2004 @@ -1669,7 +1669,7 @@ Replace these entries in the array @code{X} by zero. @end itemize In this case we need a @math{3} by @math{2} subscript array, as in the -following example. +following example: @example > x <- array(1:20,dim=c(4,5)) # @r{Generate a 4 by 5 array.}