---
title: "Diamond sizes"
date: 2022-09-12
format: html
---
```{r}
#| label: setup
#| include: false
library(tidyverse)
smaller <- diamonds |>
filter(carat <= 2.5)
```
We have data about `r nrow(diamonds)` diamonds.
Only `r nrow(diamonds) - nrow(smaller)` are larger than 2.5 carats.
The distribution of the remainder is shown below:
```{r}
#| label: plot-smaller-diamonds
#| echo: false
smaller |>
ggplot(aes(x = carat)) +
geom_freqpoly(binwidth = 0.01)
```
第 28 章 四开本
本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com
导言
Quarto 为数据科学提供了一个统一的写作框架,将你的代码、结果和散文结合在一起。Quarto 文档可完全复制,并支持 PDF、Word 文件、演示文稿等数十种输出格式。
Quarto 文件有三种使用方式:
-
用于与决策者沟通,决策者希望关注结论,而不是分析背后的代码
-
用于与其他数据科学家(包括未来的你!)合作,他们对你的结论和得出结论的方式(即代码)都很感兴趣
-
作为进行数据科学研究的环境,作为现代实验笔记本,您不仅可以记录您所做的事情,还可以记录您的想法
Quarto 是一款命令行界面工具,而不是 R 软件包。这意味着帮助基本上不能通过? 获取。因此,在学习本章和将来使用 Quarto 时,应参考Quarto 文档。
如果您是 R Markdown 用户,您可能会想:"Quarto 听起来很像 R Markdown"。你没有想错!Quarto 将 R Markdown 生态系统中的许多软件包(rmarkdown、bookdown、distill、xaringan 等)的功能统一到一个统一的系统中,并对其进行了扩展,除 R 语言外,还支持 Python 和 Julia 等多种编程语言。
先决条件
您需要使用 Quarto 命令行界面(Quarto CLI),但不需要明确安装或加载,因为 RStudio 会在需要时自动安装或加载。
四开本基础知识
这是一个 Quarto 文件--扩展名为.qmd 的纯文本文件:
它包含三类重要内容:
- 一个YAML 标头(可选),周围用
--- - 用
``` - 混合了简单文本格式的文本,如
# heading和_italics_
图 28-1显示了 RStudio 中.qmd 文档的笔记本界面,其中代码和输出交错排列。您可以单击运行图标(Run)(它看起来像位于代码块顶部的播放按钮)或按下 Cmd/Ctrl+Shift+Enter 来运行每个代码块。RStudio 会执行代码并将结果与代码联机显示。
图 28-1. RStudio 中的 Quarto ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access