Errata

Exploring Everyday Things with R and Ruby

Errata for Exploring Everyday Things with R and Ruby

Submit your own errata for this product.

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.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
PDF, ePub Page 5
Portugal

"There are #{24 * 60 * 60} seconds in a day"
=> "There are 86400 seconds in a day"

The above statement is incorrect, because in a day we have 23 hours 59 minutes 60 secondfs

Jos? Apar?cio Cascalheira Esteves  Oct 23, 2012 
Printed Page 6
bottom

Parameters for the gem command such as "--local" require two dashes, not one.

john  Aug 08, 2012 
PDF Page 6
last line

-local should be --local

Todd Trimble  Sep 22, 2012 
Printed Page 9
bottom

Array does not inherit from the Enumerable module; it *includes* the Enumerable module.

tuker  Aug 08, 2012 
Printed Page 10
middle

Array and Hash include the Enumerable module. They are not subclasses of it.

tuker  Aug 08, 2012 
Printed Page 19
middle

Use of "throw":

You almost surely mean: raise

tuker  Aug 08, 2012 
Printed Page 21
Example 1-1

Code given does not compile

Shoes.app height: 200, width: 200 do
background lightblue
stack margin: 10 do...

Should be:

Shoes.app :height => 200, :width => 200 do
background lightblue
stack :margin => 20 do ...

Dave Rosenfeld  Jan 13, 2013 
PDF Page 31
last line

Example command line refers to a filename that is different from the filename mentioned in the text. A very minor point, but may frustrate someone new to the tools.

Text reads (2nd paragraph): "... Let?s say you have a file named weight_n_height.R with ..."

Example (last line):
$ R CMD BATCH weights_n_heights.R

weight_n_height.R != weights_n_heights.R

paul gallagher  Jul 03, 2012 
PDF Page 45
2nd paragraph

Intro text says "...which teams have scored more than eight away goals", but example filters on wins.

Todd Trimble  Sep 23, 2012 
PDF Page 67
Example 3-2

The Facility class deletes a person from the population when they occupy a facility, but this should have been done when the person entered the queue. As it is, you could have a person in the queue decide that he has to go again and rejoin the queue at the end (somehow retaining his original place at the same time). Check it out -- for big populations the queue size grows larger than the population.

Jacob  Feb 26, 2013 
PDF Page 69
code sample

The code sample references a constant `DURATION` which is not defined. It is separately referenced in code sample 3-4, so should probably be defined at the top level of the `restroom.rb` file.

bleything  Jul 11, 2012 
PDF Page 73
United States

Example 3-5 listing, line 10, (starts with gpplot) should have values=c(2,3,4). values is missing an 's'. If you cut and paste into R, you get an error. The related example file from github (exp1_1.r) has the same issue.

Pressly Bonner  Jul 06, 2012 
PDF Page 73
Example 3-5 line 4

R warns when you run this script that mean(data) is now deprecated.

mean <- mean(data) should now follow the same pattern as median and max:

mean <- apply(data,2,mean)

Jacob  Feb 26, 2013 
PDF Page 79
Example 3-7

"unless queue.empty?" should be "until queue.empty?", as it was in simulation 1.

As it is, you're erasing your queue every turn (you're duplicating the queue, deleting the original, taking one off the duplicate queue, and erasing the rest).

Jacob  Feb 26, 2013 
PDF Page 83
code sample

In the code sample, there's no reason to require rubygems, and the restroom require needs to be relative to work on ruby 1.9 (ie, require './restroom')

bleything  Jul 11, 2012 
Printed Page 84
Code listing

The line of code:
data[population_size] << restrooms.inject(0) {|n,m| n + m.queue.size}
stores the total number of people in all queues. This does not produce the graph indicated in the analysis section.

Rather, the code should store the number of people in the smallest queue, something like this:
data[population_size] << restrooms.min{ |a,b| a.queue.size <=> b.queue.size}.queue.size

Andrew Cox  Jan 13, 2013 
PDF Page 85
code sample

the `scale_shape_manual()` call in the code sample passes a parameter called `value`. This should be `values`. Running the code verbatim results in an error.

bleything  Jul 11, 2012 
Printed Page 87
first paragraph

The text instructs the reader to "change the filename from simulation1.csv to simulation4-1.csv". The reader should actually change the filename to simulation3-1.csv.

Andrew Cox  Jan 13, 2013 
Mobi Page 128
2nd paragraph

... we used Ruby to extract messages from a Gmail account using SMTP.

Should be IMAP instead of SMTP

Yury Kotlyarov  Jan 20, 2014 
Printed Page 169
Extracting Data from Video

When I run extract_data_from_frames.rb, I have the error:
`<main>': undefined method `/' for nil:NilClass (NoMethodError)


I took the file here:
https://github.com/sausheong/everyday/blob/master/Chapter%206%20-%20In%20a%20Heartbeat/oximetry/extract_data_from_frames.rb#L12

everyday/Chapter 6 - In a Heartbeat/oximetry/extract_data_from_frames.rb

Vladimir  May 13, 2015