Skip to contents

英文原页:download_fishbase_data()

说明

本函数把FishBase和/或SeaLifeBase某个版本的数据表(rfishbase包使用的数据库表静态快照,parquet文件格式)下载到data_dir,以便离线使用。默认下载本包用到的数据表(species、estimate、families、synonyms、stocks和faoareas:每个数据库约15 MB);一个完整的版本,FishBase约140 MB,SeaLifeBase约110 MB。

English

This function downloads the tables of a FishBase and/or SeaLifeBase release (the static snapshots of the database tables used by the rfishbase package, as parquet files) to data_dir, so they can be used offline. By default it downloads the tables the package uses (species, estimate, families, synonyms, stocks and faoareas: about 15 MB for each database); a complete release takes about 140 MB for FishBase and 110 MB for SeaLifeBase.

用法

download_fishbase_data(
  server = c("fishbase", "sealifebase"),
  version = "latest",
  tables = "needed",
  data_dir = fao_data_dir(),
  overwrite = FALSE,
  quiet = FALSE
)

参数

server
“fishbase”、“sealifebase”或两者(默认)。
English “fishbase”, “sealifebase” or both (default).
version
要下载的版本,例如”26.06”。默认为”latest”(网上最新的版本)。
English The release to download, e.g. “26.06”. Default is “latest”.
tables
“needed”(默认)表示本包用到的数据表,“all”表示全部数据表,也可以给出表名,例如c("species", "estimate")。
English “needed” (default) for the tables the package uses, “all” for every table, or table names, e.g. c("species", "estimate").
data_dir
保存数据的目录。默认为fao_data_dir()。
English The directory where the data is saved. Default is fao_data_dir().
overwrite
逻辑值。为TRUE时,已下载的数据表会重新下载。默认为FALSE。
English A logical value. If TRUE, tables already downloaded are downloaded again. Default is FALSE.
quiet
逻辑值。为TRUE时不显示进度信息。默认为FALSE。
English A logical value. If TRUE, progress messages are not printed. Default is FALSE.

返回值

以不可见方式返回一个数据框,每张数据表一行:数据库(server)、版本(version)、表名(table)、大小(size,字节)和状态(status);状态为”downloaded”(已下载)、“already downloaded”(此前已下载)或”failed”(下载失败)。

English

Invisibly, a data frame with one row per table: server, version, table, size and status (“downloaded”, “already downloaded” or “failed”).

详细说明

提前下载不是必需的:使用FishBase数据的函数(如fishbase_match())会先在网上查找最新的版本,并下载所需的数据表。电脑离线时,它们使用在这里下载的最新版本;什么都没有下载时,fishbase_match()使用包内自带的数据表。已下载的数据表会跳过,所以下载中断后,重新运行本函数即可接着下载。

读取这些数据表需要nanoparquet包(install.packages("nanoparquet"))。FishBase和SeaLifeBase的数据由FishBase团队以CC BY-NC 4.0许可协议发布:注明出处即可使用,但不得用于商业用途。

English

Downloading beforehand is optional: functions that use FishBase data, such as fishbase_match(), look online for the newest release first and download the tables they need. When the computer is offline they use the newest release downloaded here, and when nothing has been downloaded, fishbase_match() uses the table built into the package. Tables already downloaded are skipped, so an interrupted download can be resumed by running the function again.

Reading the tables needs the nanoparquet package (install.packages("nanoparquet")). FishBase and SeaLifeBase data are licensed CC BY-NC 4.0 by the FishBase team: they can be used with attribution, but not commercially.

参考文献

Froese, R. and Pauly, D. (Eds.) FishBase. World Wide Web electronic publication. https://www.fishbase.se

Palomares, M.L.D. and Pauly, D. (Eds.) SeaLifeBase. World Wide Web electronic publication. https://www.sealifebase.se

Boettiger, C., Lang, D.T. and Wainwright, P.C. (2012). rfishbase: exploring, manipulating and visualizing FishBase data from R. Journal of Fish Biology 81(6): 2030-2039. doi:10.1111/j.1095-8649.2012.03464.x. Source code: https://github.com/ropensci/rfishbase

示例

check_fishbase_update()
download_fishbase_data()                          # the tables the package uses
download_fishbase_data(tables = "all")            # every table of FishBase and SeaLifeBase
download_fishbase_data("fishbase", tables = c("species", "estimate"))