Skip to content

Word report

HongyuLin edited this page Oct 12, 2026 · 5 revisions

评估报告 · Report (Word, LaTeX, PDF)

fao_report()对一个FAO主要渔区运行本包的分析,并写成中文或英文的Word报告:封面、标题、摘要、数据来源与分析方法、结果与结论(含图表)、参考文献和附录表格。文字由模板根据结果生成,是需要人工核对和补充的初稿,灰色字为待补充的内容。

fao_report() runs the analyses for one FAO major fishing area and writes a Word report in Chinese or English. The text is a first draft written from templates; grey notes mark what to complete by hand.

详细说明 Full guide:一键生成评估报告(English)· 参数 Arguments:fao_report()中文说明

report <- fao_report(27, lang = "zh")                          # 默认章节
report <- fao_report(27, lang = "en", citation = "apa")        # 英文报告,APA引用
report <- fao_report(27, lang = "zh", cmsy = TRUE, shocks = TRUE, mtc = TRUE)
View(report$main_species)                                      # 报告中的表格以数据框返回

输出格式 · Formats

format可选"docx"(默认)、"latex"和"pdf"中的一个或多个;分析只运行一次,各格式内容相同。format is one or more of "docx", "latex" and "pdf".

report <- fao_report(27, lang = "zh", format = c("docx", "latex", "pdf"))
report$file   # docx、latex、pdf的路径
  • LaTeX:reports/FAO27_report_zh.tex,图片在reports/FAO27_report_zh_figures/;中文用ctexart,英文用article,用XeLaTeX编译。
  • PDF:用XeLaTeX编译。先安装一次TinyTeX:install.packages("tinytex"),然后tinytex::install_tinytex()(见安装与配置);第一次会自动安装缺少的LaTeX宏包;旧版TinyTeX用tinytex::reinstall_tinytex()更新;没有tinytex时使用系统的xelatex。PDF needs XeLaTeX: install TinyTeX once with tinytex::install_tinytex().
  • 字体取自本机:Windows为仿宋、黑体、楷体;macOS为STFangsong、Heiti SC、Kaiti SC;Linux为TeX Live的Fandol字体。

章节开关 · Sections

开关 Switch 默认 Default 函数 Function 前缀 Prefix
total TRUE fishing_area_data() total_
species TRUE fishing_area_species() species_
countries TRUE fishing_area_country() countries_
groups TRUE species_group_composition() groups_
status TRUE stock_status() status_
quality TRUE data_quality() quality_
diversity TRUE diversity_concentration() diversity_
fleets TRUE coastal_distant() fleets_
shocks FALSE catch_shocks() shocks_
collapse FALSE collapse_analysis() collapse_(另有collapse_seed)
synchrony FALSE catch_synchrony() synchrony_
pelagic FALSE pelagic_demersal() pelagic_
mtc FALSE mean_temperature_catch() mtc_
distant FALSE distant_water_profile() distant_(另有distant_countries)
cmsy FALSE cmsy_area()、cmsy_input() cmsy_

摘要、方法、结论和参考文献都随打开的章节变化。The abstract, methods, conclusions and references follow the sections switched on.

带前缀的设置 · Prefixed settings

各章节函数的参数加上章节名前缀即可在报告中设置,例如:Give the arguments of a section's function with the section name as prefix:

fao_report(27,
  species_h_value = 0.2,            # fishing_area_species(h_value = 0.2)
  status_smooth = TRUE,             # stock_status(smooth = TRUE)
  collapse = TRUE, collapse_method = "worm2006",
  cmsy = TRUE, cmsy_top = 5,        # cmsy_area(top = 5)
  cmsy_settings = list(n.iter = 100000))

名称写错时会报错并列出该函数的参数。报告自行设定的参数(area_data、area_name、area、lang、table、pptx)不能更改。A wrong name gives an error listing the arguments.

格式 · Format

  • 中文报告:A4;正文仿宋和Times New Roman,小四,1.5倍行距,首行缩进2字符;三线表;参考文献按GB/T 7714—2015顺序编码制。
  • English reports: Arial by default (or Times New Roman), APA (default) or FAO citations.
  • 学名用斜体。Scientific names in italics.
  • 图表分辨率:dpi参数,默认300 dpi,印刷可用dpi = 600。Chart resolution: dpi (300 by default, e.g. dpi = 600 for print).
  • 修改文字模板:inst/extdata/report_text.csv;参考文献:inst/extdata/report_references.csv。

Clone this wiki locally