The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

luke.bace (66) [Avatar] Offline
Please post all errata here.
jperickson (15) [Avatar] Offline
Re: Errata - 2.3.11
When reading in the Crime and Punishment tables, there is an error on line 3:

crimedat <- sqlFetch(myconn, Crime) should read
crimedat <- sqlQuery(myconn, "select * from Crime"smilie
or supply a description of the difference between the two functions.

You also might want to consider capitalizing select and from.

Thank you!
jperickson (15) [Avatar] Offline
Re: Errata - 4.3
In the paragraph before section 4.4 begins, the leading letter 'l' is in the wrong type format. The remaining "eadership$age" is in the correct format.
jperickson (15) [Avatar] Offline
Re: Errors and Corrections
In the examples right before section 4.10.2 begins, in the 2nd example there should be a space added after "<-" on line 2. It should read:

newdata <- leadership[myvars]
jperickson (15) [Avatar] Offline
Re: Errata - 4.10.4
In the second example, you use "select=gender:q4" but in the explanation, you said that you are keeping variables gender through q5. Should read "...gender through q4."
jperickson (15) [Avatar] Offline
Re: Errata - Table 5.3 Statistical Functions
On the description of the scale() function, there is a reference to an example of this function in Listing 4.2, but Listing 4.2 contains no such example.
jperickson (15) [Avatar] Offline
Re: Errata - 5.2.3 Probability Functions
Type format is incorrect on "r = random generation (random deviates)." The 'r' in "random" should match the rest of "random generation..."
jperickson (15) [Avatar] Offline
Re: Errata - Listing 5.6
Halfway through the listing, the text formatting is incorrect for the section where is the roster is ordered.
jperickson (15) [Avatar] Offline
Re: Errata - 5.4.2 Conditional execution
In the 'switch' explanation, the formatting of the word "the" is incorrect on the line after "switch (expr, ...)
jperickson (15) [Avatar] Offline
Re: Errata - 5.6.3 The reshape package
Right above the 'melting' example, there is a reference to 'table x.x' which should read "Table 5.5"

Message was edited by:
gleepy (1) [Avatar] Offline
Re: Errata - Preface
The Q quote probably should be attributed to: Q, _Star Trek: The Next Generation_, "Q-Who"

I only knew that as the Trekie/er in me remembered that.
Lercher (1) [Avatar] Offline
Re: Errors and Corrections
Error reporting

Listing 7.16 Using the table2flat function with published data
> treatment <- rep(c("Placebo", "Treated"smilie, 3)
> improved <- rep(c("None", "Some", "Marked"smilie, each=2)
> Freq <- c(29,13,7,7,7,21)
should be:
> Freq <- c(29,13,7,17,7,21)
bleything (1) [Avatar] Offline
Re: Errors and Corrections
In the "case identifiers" section just before 2.2.5 starts, the following sample is given:

"patientdata <- data.frame(patientID, age, diabetes, status, rownames=patientID)"

looking at the documentation for data.frame, it appears that should be "row.names=1", though I may be misunderstanding.

If I use "rownames=patientID" like it suggests, I get a new column in the frame called "rownames". If I use "row.names=patientID", nothing happens. If I use "row.names=1", I get the expected result.

Again, I may be misunderstanding the purpose of all this, but I think that "row.names=1" is what is trying to be conveyed.
mike.clark (1) [Avatar] Offline
Re: Errors and Corrections
Enjoying the book so far!

Found what I think is an error in Chapter 4. In section "4.10.3 Selecting observations," there appears to be two errors. First, in the discussion of listing 4.6, point "2" the logical comparison should return a vector c(TRUE, TRUE, FALSE, TRUE, FALSE) (last element is incorrect.)

Next, the first vector compared in point "3" does not match the vector in point "1" (again, last element is incorrect). Note that the resulting vector in point "3" appears to be the correct result if all other vectors are corrected.

Mike C.
jkuusik (6) [Avatar] Offline
Re: Errors and Corrections
In version R 2.13.0 next code does not work (pg.386, 1/4/2011 version of book)

fa.parallel(Harman23.cor$cov, n.obs=302, fa="pc", ntrials=100, show.legend=FALSE, main="Scree plot with parallel analysis")

Instead of "ntrials=100" a parametrization "n.iter=100" should be used...

with best wishes,
lockedoff (3) [Avatar] Offline
Re: Errors and Corrections - Note for Listing 6.6
"3 Same histogram with rug plot and frame
4 Histogram with superimposed normal curve"

should read

"3 Same histogram with rug plot
4 Histogram with superimposed normal curve and frame"

or the corresponding Figure 6.8 should be fixed. The "frame" (box()) was applied to the fourth figure, not the third.
lockedoff (3) [Avatar] Offline
Errors and Corrections - Note for Page 104
"The multiple R-squared is also the correlation between the actual and predicted value (i.e., $R^2 = r_{hat{Y}Y}$)."

Should this not read as follows?

"The multiple R-squared is also the squared correlation between the actual and predicted value (i.e., $R = r_{hat{Y}Y}$)."
robert.kabacoff (170) [Avatar] Offline
Re: Errata - 2.3.11
lockedoff (3) [Avatar] Offline
Errors and Corrections - Page 305
Under "LOWESS vs. LOESS"

"The loess() function is a new, formula bases..."

should probably read

"The loess() function is a new, formula-based..."
rmsharp (7) [Avatar] Offline
Re: Errors and Corrections - Appendix F
Appendix F is missing a reference to ggplot2 by Hadley Wickham used in chapter 16.
rmsharp (7) [Avatar] Offline
Re: Errors and Corrections - Chapter 14.1 p 333 typographical error
The second sentence of the first paragraph of section 14.1 begins with "In this chapter, in this chapter,...."
The second "in this chapter, " should be removed.
jstim (1) [Avatar] Offline
Re: Errors and Corrections
I'm currently looking at the sample of Chapter 1, and in table 1.4, it says the output type for the png() function is PBG.

This should really be "PNG", right?
robert.kabacoff (170) [Avatar] Offline
Re: Errors and Corrections
Absolutely. Sorry about that.

Niall Bolger (2) [Avatar] Offline
Re: Errors and Corrections
Another minuscule error: On page 194, bottom of page: "hasn't see" should be "hasn't seen".
finnb (2) [Avatar] Offline
Re: Errors and Corrections
Part 9.6, page 237.
Bracket missing after conc
fit <- aov(uptake ~ conc*Type + Error(Plant/(conc), w1b1)

Q. Should the line be typed
fit <- aov(uptake ~ Type*conc + Error(Plant/(conc)) , w1b1)
to align with repeated measures formula on page 223?
adigs (1) [Avatar] Offline
Errata: 8.3.1
Best R book I've seen - thank you.

Figure 8.6 (8.3.1, p189 ebook) shows the wrong plot: it's a duplicate of Fig 8.8 (states regression), instead of the women$height/$weight regression diagnostic plots.

xallanmillerx (1) [Avatar] Offline
Re: Errors and Corrections
The call to cor.test(states[,3], states[,5] on page 162 is referred to on page 163 as "This code tests the null hypothesis that the Pearson correlation between life expectancy and murder rate ..." but column 3 is Illiteracy (5 is the murder rate, confirmed).

Shouldn't the call test the correlation between column 4 ("Life Exp") and 5?
Stevedas (3) [Avatar] Offline
Re: Errors and Corrections
There seems to be a problem with section on importing data from excel section:

On P36 "Importing data from excel" I created an excel file called test in the working directory and used the following code similar to the example on pages 36 to 37:

> channel <-odbcConnectExcel("test.xls"smilie
> mydataframe <- sqlFetch(channel,"Sheet1"smilie

but I receive the folowing error:
‘Sheet1’: table not found on channel

The excel worksheet is definitely called "Sheet1". and the excel file is called test.xls. I have no idea why this is not working. The second argument to sqlFetch is the Excel worksheet..I know this definitely exists and it is called Sheet1.
Stevedas (3) [Avatar] Offline
Re: Errors and Corrections
On page 69 the third line below should read...
plot(mtcars$mpg,mtcars$wt... ) instead of plot(mtcars$wt, mtcars$mpg..) as in

opar <- par(no.readonly=TRUE)
> par(fig=c(0, 0.8, 0, 0.smilie)
> plot(mtcars$wt, mtcars$mpg, xlab="Miles Per Gallon", ylab="Car Weight"smilie
> par(fig=c(0, 0.8, 0.55, 1), new=TRUE)
> boxplot(mtcars$wt, horizontal=TRUE, axes=FALSE)
> par(fig=c(0.65, 1, 0, 0.smilie, new=TRUE)
> boxplot(mtcars$wt, axes=FALSE)
> mtext("Enhanced Scatterplot", side=3, outer=TRUE, line = -3)
> par(opar)

Am I wrong on this? The box plots should correspond to the respective axiis.
avolkov (1) [Avatar] Offline
Re: Errors and Corrections
I have translated "R in Action" into Russian (the translation will be published soon). Here are errors and corrections.

p. xv, par. 2. is that is -> is that it
p. 16, section 1.4.3. packaged -> package
p. 28, listing 2.5. in patient data frame -> in patientdata data frame
p. 55, "the second plot... blue lines" -- lines are red on fig. 3.7!
p. 81, table 4.4. day number 00-31, month number 00-12?? Why starting from 00?
p. 122, listing 6.2. plots_W_
p. 122. "legend.text parameter" what is it?
p. 122-123. aggregate and barplot functions -- typed with not monospaced font
p. 132. my next car will have EIGHT cylinders (not four, the milleage is highest for them)
p. 133, fig. 6.11. M_IL_es per Ga_LL_on
p. 137, line 1. Widths of all boxes are equal!
p. 144, listing 7.3. package_()_
p. 155. Improve -> Improved
p. 206. Population^1.36 -> Illiteracy^1.36
p. 210. up to a model with all predictors -- two best models?
p. 245. 2time -> 2times
p. 247. s -> S
p. 250. option "type=" is forggoten in pwr.t.test
p. 250. is sigma squared or not?
p. 252. "a difference of 0.625 seconds or less" -- or more?
p. 252. pwer.t.test -> pwr.t.test
p. 253-254. in formulas^ f2 or f^2?
p. 263. "This chapter covers" -- no association plots are dicussed
p. 270. "You can see that the highest correlations are between weight and displacement..." not highest but with highest absolute

value (module)
p. 283. "Consider the correlations among the variables in the mtcars data frame" It's not correct to analyse Pearson correlatinos

between dichotomous variables.
p. 294. "function_name( formula, data, distribution= )" data -> data=
p. 299 and 300. Names of listings: tests -> test
p. 302. permutation tests were provided -> permutation test was provided
p. 308. > print -> print
p. 309. 95 percent confidence intervals for car weight -> ... intervals of regression coefficient for car weight
p. 311. datasets.Chapter -> datasets. Chapter
p. 315. lm() -- not monospaced font
p. 326. 20 percent decrease -> 14%
p. 330. robust package: robust is in not monospaced font
p. 337. explained in section 14.3.3 -> ... 14.2.3
p. 337. the value for the first component is 10. -> 10.13
p. 338, table 14.3. lower.leg -> lower leg
p. 345. from section 14.3.4 -> ... 14.3.2
p. 359. "Note that in figure 15.3, red has
been replaced with crosshatching by hand, so that the missing values are viewable in
grayscale. It will look different when you create the graph yourself." -- no, there is still red in the book.
p. 384, group=option -- space is needed
p. 388. The > symbol should be ommited from the code
p. 391. scatter plot matrix -> scatter plot
p. 397. iplot -> iplots
p. 401. Design, Monitoring, and Analysis of Clinical Trials
Clinical Trial Design, Monitoring, and Analysis
one of these should be removed (dublicate)
p. 411. use can use -> you can use
p. 413. length(unique(trt)) -- both last brackets should be in bold italic
p. 415. "The Not So Short Introduction to LaTeX 2e,” -- no comma is needed
p. 416. "If you look at Figure D.4..." -> ... D.5...
doman1248 (2) [Avatar] Offline
Typo on Page 59 - "Listing 3.2 An example of custom axes"
The text has:

mtext("y=1/x", side=4, line=3, cex.lab=1, las=2, col="blue")

while "y=1/x" should be "y=10/x":

mtext("y=10/x", side=4, line=3, cex.lab=1, las=2, col="blue")
doman1248 (2) [Avatar] Offline
Error on Page 69 - "Listing 3.4 Fine placement of figures in a graph"
Book has:

plot(mtcars$wt, mtcars$mpg,
xlab="Miles Per Gallon",
ylab="Car Weight")

While it should be:

plot(mtcars$wt, mtcars$mpg,
xlab="Car Weight",
ylab="Miles Per Gallon")

As a result, Figure 3.18 is incorrectly labeled as well.
"Car Weight" should be on x-axis while "Miles Per Gallon" on the y-axis. Need to fix this because I stared at this figure for a long time because it just didn't make sense and the labeling was the cause of the confusion.