Many books that are published on R are also freely available online at Bookdown.org. If authoring a book in R, then use the bookdown package.