The errata list is a list of errors and their corrections that were found after the product was released.
The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.
Version |
Location |
Description |
Submitted by |
Date submitted |
Printed |
Page x
2 paragraph |
Not an error per se but a consideration: why are the examples provided as *.txt files instead of .R or .Rmd files? It makes it much easier to work with them in R Studio if they are provided with the latter extensions. Now I had to rename all the files in order to use them more easily in the IDE (select a code block and run it). Thanks, great book!
|
Kevin D'Elia |
Sep 25, 2015 |
ePub |
Page 5
1st paragraph |
The supplementary material consists of a bunch of .txt files, and a novice R user might wonder what to do with these.
I ended up renaming them to .R so that in RStudio I can send lines to the console. You should at least provide some form of explanation what to do with these files.
|
Matthias Flor |
Dec 25, 2013 |
PDF |
Page 12-13
Following Figure 2-5 |
In the current version of ggplot2, It appears that qplot does not support stat="identity" when geom="bar".
A similar finding applies to the curve-plotting example on page 18, following figure 2-12; qplot does not have a parameter fun=.
This is RStudio, Version 0.99.903, ggplot2 version is 01-03-2016.
|
W. Krebs |
Aug 07, 2016 |
Printed |
Page 12
1st paragraph |
> qplot(BOD$Time, BOD$demand, geom="bar", stat="identity")
Error: stat_count() must not be used with a y aesthetic.
In addition: Warning message:
`stat` is deprecated
> qplot(factor(BOD$Time), BOD$demand, geom="bar", stat="identity")
Error: stat_count() must not be used with a y aesthetic.
In addition: Warning message:
`stat` is deprecated
|
sam |
Nov 11, 2016 |
PDF |
Page 18
figure 2-13 |
In figure 2-13,the label on x axis should be 'x' and not 'c(0,20)'
following is the command to get figure 2-13
ggplot(data.frame(x=c(0, 20)), aes(x=x)) + stat_function(fun=myfun, geom="line")
When I execute this command, x-axis label is 'x'
ISBN: 978-1-449-31695-2
thanks
rahul
|
Rahul |
Dec 02, 2015 |
PDF |
Page 21
Figure 3-3 |
Figure 3-3 is supposed to be the output of the command
ggplot(pg_mean, aes(x=group, y=weight)) +
geom_bar(stat="identity", fill="lightblue", colour="black")
The dataset pg_mean doesn't have variables 'day' and 'mean_bill' as given in the figure.
ISBN: 978-1-449-31695-2
thanks
rahul
|
Rahul |
Dec 02, 2015 |
Printed |
Page 36
Section titled "Discussion" |
In explaining the example, the variable "Weight" is given as the splitting factor variable when I believe it should be "Date"
|
Kevin D'Elia |
Oct 01, 2015 |
Printed |
Page 41
Figure 3-24 |
I worked with table 'ce' on page40 and the following ggplot-script.
I got a graph, where the areas were in the wrong order: in column 1, d 16, the red lower area (= c 39) was limited at 2.26, the blue upper area with label 2.26 was 5.44 - 2.26 = 3.18.
I tried again and again, the results were the same. There must be a mistake in combining label and area.
|
Heinrich Iversen |
Sep 04, 2017 |
Printed |
Page 46
code |
I would like to report a possible typpo in page 46 to 48 Chapter2: Bar Graphs in the first edition of R Graphics Cookbook from the code provided in the book, which is listed below.
ggplot(tophit, aes(x=avg, y=name)) +
geom_segment(aes(yend=name), xend=0, colour="grey50") +
geom_point(size=3, aes(colour=lg)) +
scale_colour_brewer(palette="Set1", limits=c("NL","AL")) +
theme_bw() +
theme(panel.grid.major.y = element_blank(), # No horizontal grid lines +
legend.position=c(1, 0.55), # Put legend inside plot area +
legend.justification=c(1, 0.5))
We can get a unsorted plot, but not the plot shown in the book. with the code below, we can get the same plto shown in the book.
ggplot(tophit, aes(x=avg, y=reorder(name,avg))) +
geom_segment(aes(yend=name), xend=0, colour="grey50") +
geom_point(size=3, aes(colour=lg)) +
scale_colour_brewer(palette="Set1", limits=c("NL","AL"), guide=FALSE) +
theme_bw() +
theme(panel.grid.major.y = element_blank()) +
facet_grid(lg ~ ., scales="free_y", space="free_y")
|
Anonymous |
Apr 01, 2015 |
Printed |
Page 87
Figure 5-15 |
The actual code is at the bottom of page 86. I do not think the code at the bottom of page 86 priduces the exact chart on Figure 5-15 Left. The legend on the chart I get has a legend similar to Figure 5-14 Right but with an upper limit of 8000. I think the breaks=c(0,250,500,1000,2000,4000,6000) line is missing.
|
JF Prieur |
Jul 30, 2013 |
Printed |
Page 95
1st paragraph (Code example) |
sp <- ggplot(heightweight, aes(x=ageYear, y=heightIn)) +
geom_point(colour="grey40")
sp + geom_line(data=predicted, size=1)
Gives error in RStudio (0.98.501) R (3.0.2) : Error in eval(expr, envir, enclos) : object 'heightIn' not found
|
Marc Telesha |
May 30, 2014 |
Printed, PDF |
Page 118
bottom |
binsize <- diff(range(faithful$waiting))/15
This way actually produces 16 bins.
It is worth adding some remarks:
The default interval of base hist is of the form (a, b], which is opposite to geom_histogram's default.
A way to produce an identical plot to hist using ggplot by calling pretty(): http://stackoverflow.com/questions/14200027/how-to-adjust-binwidth-in-ggplot2
|
colin fang |
Sep 03, 2013 |
PDF |
Page 215
Table 9-2 |
This table details theme items that control text appearance in graphs. However:
axis.ticks
axis.ticks.x
axis.ticks.y
Seem to refer to the lines that make up tick marks rather than text properties. They yield an error ("Element axis.ticks must be a element_line object") when trying to set them in the same way as in the examples given for axis.title etc.
I think those element names should actually be:
axis.text
axis.text.x
axis.text.y
VERY useful book though. Cheers.
|
Michael MacAskill |
Jul 24, 2013 |
Printed |
Page 219
Second line from bottom |
# theme() works if after a comp*l*ete theme
Typo: should read comp*l*ete instead of compete
|
Anonymous |
Apr 03, 2014 |
ePub |
Page 225
Figure A-11 |
The code that is supposed to produce Figure A-11 is faulty, the geom_point() command is missing an aesthetics mapping, it should read
p + geom_point(aes(colour=group)) + scale_colour_manual(values=c("orange","forestgreen"))
|
Matthias Flor |
Dec 25, 2013 |
PDF |
Page 246
Section 11.3 Changing the text of facet labels |
The stated solution here to change the text of facet labels is to rename the factor levels.
I'd suggest that it is better to rename the "labels" rather than the "levels" of the factor. i.e. factor level names are often used in code (e.g. to subset data, etc). Changing their names can therefore often break code which uses that variable, which isn't desirable just to achieve a cosmetic change in a graph.
However, ggplot seems to be clever enough to use the labels of a factor instead of the level names, if they have been specified. These factor labels are also just cosmetic, so it seems better coding practice to change them rather than the level names to achieve a graph formatting change.
Cheers,
Michael
|
Michael MacAskill |
Jul 24, 2013 |
Printed |
Page 284
'segments3d ' (2 times) |
in "segments3d" either the number of commas is incorrect, or the commas are not correctly distributed.
Result: I don't get the blue vertical segments/lines.
H. I.
|
Anonymous |
Jun 16, 2017 |
Printed |
Page 309
3rd paragraph |
The below coding needs a package mapproj to be loaded.
ggplot(states_map,aes(x=long,y=lat,group=group)) + geom_path() + coord_map("mercator")
|
Seung Jin Han |
May 17, 2017 |
PDF |
Page 360, 361
ggplot code samples |
In the bar chart examples the final geom_bar(position="dodge") calls give an error and won't plot anything.
To fix these, they should be have the parameter stat = "identity" added.
The full error:
Error : Mapping a variable to y and also using stat="bin".
With stat="bin", it will attempt to set the y value to the count of cases in each group.
This can result in unexpected behavior and will not be allowed in a future version of ggplot2.
If you want y to represent counts of cases, use stat="bin" and don't map a variable to y.
If you want y to represent values in the data, use stat="identity".
See ?geom_bar for examples. (Defunct; last used in version 0.9.2)
|
Robert |
Oct 24, 2014 |
PDF |
Page 362
Top paragraphs |
Recipe 15.18 refers to two identical code samples as if they were different implementations of the same functionality.
The way the start of the recipe's Discussion section and the notes immediately prior to it read, the code example in the Solution section should be something that does two calls in a succession for calculating the newly summarized statistics.
But instead both code samples are the same (save for some whitespace at the end, and the local variable assignment at the beginning).
|
Robert |
Oct 24, 2014 |
PDF |
Page 362
Code samples in middle and at the bottom of the page |
The confidence interval calculation's two code samples are inconsistent with each other.
One uses qt(.975, ca$n-1) as a multiplier while the other one's is qt(.975, ca$n).
|
Robert |
Oct 24, 2014 |
Printed |
Page 362
The discussion of confidence intervals |
A confidence interval consists of two numbers, the upper and lower limits, but in these examples only one number is generated, in the column "ci". It seems to me that what is being calculated here is the 0.975 quantile of the posterior PDF for the standard error se. Accordingly, the penultimate line of code on page 363 should read
ciMult <- qt( 1 - ( 1 - conf.interval ) / 2, data$n-1)
|
Anonymous |
Apr 18, 2015 |
PDF |
Page 377
Figure A-5 |
Figure A-5 Does not correspond to the code
|
Libardo Lopez |
Jun 11, 2014 |
Other Digital Version |
381
Last code chunk |
I guess that in the following piece of code:
p + geom_point() +
scale_colour_manual(values=c("orange","forestgreen"))
you forgot about mapping variable 'group' to colour. It should be:
p + geom_point(aes(colour=group)) +
scale_colour_manual(values=c("orange","forestgreen"))
Cheers,
Bartek
|
Bartek |
Jul 25, 2013 |