开始使用免费开始使用

设置日期格式

现在您的报告已经包含更多高层信息,您还想以另一种格式加入日期。请参考下方视频中的日期格式选项表。

Date formatting option tables.png

本练习是课程的一部分

使用 R Markdown 生成报告

查看课程

练习说明

  • 在 YAML 头部使用 Sys.time() 函数修改日期,使其显示为十进制日、月份英文全称和四位年份,例如:08 April 2020。

交互式实操练习

通过完成这段示例代码来试试这个练习。

{"investment_report.Rmd":"---\ntitle: \"Investment Report\"\nauthor: \"Add your name\"\ndate: \"`r format(___, '___')`\"\noutput: html_document\n---\n\n```{r data, include = FALSE}\nlibrary(readr)\n\ninvestment_annual_summary <- read_csv(\"https://assets.datacamp.com/production/repositories/5756/datasets/d0251f26117bbcf0ea96ac276555b9003f4f7372/investment_annual_summary.csv\")\ninvestment_services_projects <- read_csv(\"https://assets.datacamp.com/production/repositories/5756/datasets/78b002735b6f620df7f2767e63b76aaca317bf8d/investment_services_projects.csv\")\n```\n\n\n## Datasets \n\n### Investment Annual Summary\n\nThe `investment_annual_summary` dataset provides a summary of the dollars in millions provided to each region for each fiscal year, from 2012 to 2018.\n```{r}\ninvestment_annual_summary\n```\n\n### Investment Services Projects\n\nThe `investment_services_projects` dataset provides information about each investment project from the 2012 to 2018 fiscal years. Information listed includes the project name, company name, sector, project status, and investment amounts.\n```{r}\ninvestment_services_projects \n```\n\n\n"}
编辑并运行代码