Repository navigation
Installation
需要R 4.2或以上版本。faofishingreport needs R 4.2 or later.
install.packages("remotes")
remotes::install_github("Linbojun99/faofishingreport", dependencies = TRUE)分析所用的R包会随本包一起安装:Word报告用的officer和xml2、PowerPoint用的eoffice、FishBase数据用的nanoparquet、海表温度用的ncdf4,以及CMSY++所需的R包(rjags和R2jags除外,它们需要先安装JAGS程序,见下文)。这些包只在用到时才加载。
All the packages the analyses use are installed with the package: officer and xml2 (Word reports), eoffice (PowerPoint), nanoparquet (FishBase), ncdf4 (sea surface temperature) and the R packages of CMSY++, except rjags and R2jags, which need the JAGS program (below). They are loaded only when needed.
| 系统 System | 说明 Notes |
|---|---|
| Windows | 图表中文字体为SimSun(宋体)。Chinese chart font: SimSun. |
| macOS | 图表中文字体为Songti SC。保存可编辑的PowerPoint图表(pptx = TRUE)需要安装XQuartz。Chinese chart font: Songti SC; editable PowerPoint charts need XQuartz. |
| Linux | 图表中文字体为Noto Serif CJK SC,例如在Ubuntu上安装fonts-noto-cjk。Chinese chart font: Noto Serif CJK SC (e.g. sudo apt-get install fonts-noto-cjk). |
字体未安装时会使用下一个可用的中文字体;也可以用fao_font("字体名")指定。If the font is missing, the next available Chinese font is used; set another with fao_font("name").
只有做CMSY++资源评估(cmsy_area()、cmsy_run()、fao_report(cmsy = TRUE))才需要JAGS。运行一次:
JAGS is needed only for CMSY++ stock assessments. Run once:
cmsy_setup() # 安装R包,下载并打开与本机R版本匹配的JAGS安装程序
cmsy_system() # 检查本机的R、JAGS和R包JAGS是独立程序:Windows和macOS上会打开安装程序,按步骤完成后重启R再运行一次cmsy_setup();Linux上会显示安装命令。版本对应关系见CMSY++资源评估。
JAGS is a separate program: on Windows and macOS the installer opens; restart R afterwards and run cmsy_setup() again. On Linux the install command is shown. See CMSY for the versions.
只有输出PDF报告(fao_report(format = "pdf"))才需要LaTeX;Word报告和LaTeX源文件(format = "latex")不需要。最简单的是TinyTeX,在R中安装,不需要管理员权限。运行一次:
LaTeX is needed only for PDF reports. The simplest is TinyTeX, installed from R without administrator rights. Run once:
install.packages("tinytex")
tinytex::install_tinytex() # 几分钟;装完后重启R · a few minutes; restart R afterwards
tinytex::is_tinytex() # TRUE表示安装成功 · TRUE when installed第一次生成PDF时,TinyTeX会自动下载报告用到的宏包(中文报告需要ctex等)。很早以前安装的TinyTeX如果提示“TeX Live is older than remote”,运行tinytex::reinstall_tinytex()更新。详见网站的安装TinyTeX(English)。
The first PDF downloads the LaTeX packages the report uses. If an old TinyTeX says "TeX Live is older than remote", update it with tinytex::reinstall_tinytex().
下载的FAO数据、FishBase数据表和海表温度数据保存在fao_data_dir()返回的文件夹中,按以下顺序确定:
-
fao_settings(data_dir = "...")设置的文件夹(本次R会话有效); - 环境变量
FAOFISHINGREPORT_DATA_DIR; - R的用户数据文件夹
tools::R_user_dir("faofishingreport", "data")。
多台电脑或团队共用一个文件夹(例如云盘)时,在~/.Renviron中加一行后重启R:
Downloaded FAO data, FishBase tables and SST data are kept in fao_data_dir(): the folder set with fao_settings(data_dir = ), else the environment variable FAOFISHINGREPORT_DATA_DIR, else R's user data folder. To share one folder between computers or a team, add to ~/.Renviron and restart R:
FAOFISHINGREPORT_DATA_DIR=/path/to/shared/folder
图表和表格保存在当前工作目录(getwd())下:Charts and tables are saved in the working directory:
| 文件夹 Folder | 内容 Contents |
|---|---|
figures/png/ |
PNG图表(按分析分子文件夹,如area/、summary/、cmsy/) |
figures/pptx/ |
可编辑的PowerPoint图表(pptx = TRUE或fao_settings(pptx = TRUE)时) |
tables/ |
CSV表格(UTF-8带BOM,Excel可直接显示中文) |
reports/ |
fao_report()生成的Word报告 |
faofishingreport · 网站 Website · GitHub · 问题反馈 Issues · GPL-3 · 本包与FAO无关联,数据来源为FAO。This package is not affiliated with FAO; the data come from FAO.
faofishingreport 1.0.0
- 首页 Home
- 安装与配置 Installation
- 教程 Tutorial(FAO 67区)
- 快速入门 Quick start
- 函数一览 Function index
- 数据与版本 Data and versions
- 评估报告 Report
- 扩展 Extensions
- CMSY++资源评估
- 常见问题 FAQ
- 开发说明 Development
网站 Website