# 在Covid-19检疫期间齐鲁风采群英会免费的Springer书籍的包裹

Antoine Soetewey 2020-04-26 42 minute read

# 介绍

• 如何齐鲁风采群英会 所有可用的教科书 at once and
• 如何齐鲁风采群英会一个 书籍子集，给定特定的标题，作者或主题

# 安装

After having installed the {devtools} package, you can install the {springerQuarantineBooksR} 包裹 from GitHub and load it with:

# install.packages("devtools")
devtools::install_github("renanxcortes/springerQuarantineBooksR", force = TRUE)
library(springerQuarantineBooksR)

# 立即齐鲁风采群英会所有书籍

First, set the path where you would like to save all books with the setwd() function then download all of them at once with the download_springer_book_files() function. Note that it takes several minutes (depending on the speed of your internet connection) since all books combined amount for almost 8GB.

setwd("path_of_your_choice") # where you want to save the books
download_springer_book_files() # download all of them at once

If you want to download the EPUB version (or both the PDF and EPUB versions), add the filetype argument to the function:

# for EPUB version:

# for both PDF and EPUB versions:
download_springer_book_files(filetype = "both")

By default, it downloads only the English books. However, it is also possible to download all German books by adding the argument lan = 'ger':

download_springer_book_files(lan = 'ger')

# 创建一个斯普林克书籍的表

Like me, if you do not know which books are offered by Springer and you do not want to download all of them, you probably may want to have an overview or a list of the released books before downloading any. For this, you can load a table containing all the titles made available by Springer into an R session with the download_springer_table() function:

springer_table <- download_springer_table()

This table can then be improved with the {DT} 包裹 to:

• 只保留最少的信息，
• 允许通过其标题，作者，分类或年来搜索书籍，
• 允许齐鲁风采群英会可用书籍列表，和
• 例如，使Springer链接可点击
# install.packages("DT")
library(DT)

springer_table$open_url <- paste0( '<a target="_blank" href="', # opening HTML tag springer_table$open_url, # href link
)

springer_table <- springer_table[, c(1:3, 19, 20)] # keep only relevant information

datatable(springer_table,
rownames = FALSE, # remove row numbers
filter = "top", # add filter on top of columns
options = list(
autoWidth = TRUE,
pageLength = 5, # show first 5 entries, default is 10
order = list(0, "asc") # order the title column by ascending order
),
escape = FALSE # make URLs clickable
)

Note that you can create a similar table for German books with the download_springer_table(lan = "ger") function.

# 只齐鲁风采群英会特定的书籍

## 按标题

download_springer_book_files(springer_books_titles = "All of Statistics")

download_springer_book_files(
springer_books_titles = c(
"All of Statistics",
"A Modern Introduction to Probability and Statistics"
)
)

springer_table <- download_springer_table()

library(dplyr)
specific_titles_list <- springer_table %>%
filter(str_detect(
book_title, # look for a pattern in the book_title column
"Statistics" # specify the word
)) %>%
pull(book_title)

download_springer_book_files(springer_books_titles = specific_titles_list)

## 由作者

springer_table <- download_springer_table()

# library(dplyr)
specific_titles_list <- springer_table %>%
filter(str_detect(
author, # look for a pattern in the author column
"John Hunt" # specify the author
)) %>%
pull(book_title)

download_springer_book_files(springer_books_titles = specific_titles_list)

## 按主题

You can also download all textbooks covering a specific subject (see all subjects in the 学科_classification column in the summary table). For instance, here is how to download all books categorized in the Statistics subject:

springer_table <- download_springer_table()

# library(dplyr)
specific_titles_list <- springer_table %>%
filter(str_detect(
subject_classification, # look for a pattern in the subject_classification column
"Statistics" # specify the subject
)) %>%
pull(book_title)

download_springer_book_files(springer_books_titles = specific_titles_list)

# 改进

• 添加齐鲁风采群英会所有版本的一本书的可能性。目前，只能齐鲁风采群英会最新版本。
• 如果停止，请添加恢复齐鲁风采群英会的可能性。目前，如果代码再次执行，则齐鲁风采群英会从头开始。
• 按主题齐鲁风采群英会书籍的可能性。目前，只有可能的 标题, 作者 或者 学科.

# 致谢

• renan Xavier Cortes（以及所有贡献者）提供此包装
• springer_free_books Python project which was used as inspiration to the {springerQuarantineBooksR} package
• 最后但并非最不重要的是，斯普林人免费提供许多优秀的书籍！

1. 我感谢作者让我在博客帖子中呈现他的包裹。↩︎

2. Note that you can change the folder name by specifying the argument destination_folder = "name_of_your_choice".↩︎