Chapter 3 of Modeling data with functional programming in R is out
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Chapter 3 of my book “Modeling data with functional programming in R” is available for download. This chapter describes map-vectorization and how it’s used in R. I make a distinction between different types of vectorization since f(x) = x^2 + 2*y - 5
is vectorized differently from sum(x)
. I call the first form map-vectorization, after the higher-order function map. In R, we call this apply
, though conceptually they represent the same operation.
This chapter uses the ebola.sitrep
package I wrote as the basis for examples. The package downloads and parses PDF situation reports from the Health Ministries of Liberia and Sierra Leone. The parsing process is filled with examples of map operations, and I discuss numerous cases in the chapter. I also delve into some of the properties of map and how these can be used to reason about your code to ultimately implement your ideas succinctly.
Thanks for reading, and all germane comments are welcome.
Modeling data with functional programming – Map vectorization
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.