See comments here.
Chapter 10.5 Filtering out zero-variance features has some issues.
The logic presented is flawed, and essentially removes low-variance features.
Additionally the use of raw counts for the calculation of SD should be reassessed; Is it sound?
The text and code also needs polishing as currently the almost the same paragraph is repeated twice in succession and there is a unused variable (th <- 1).