ペンギンデータQuartoを練習

Quarto

Authors

川端潤

KAWABATA Jun

Published

November 5, 2024

1)Quarto(クオート)

You tube Link ここでQuarto について一緒に学習できる。

ここの情報も必見 https://quarto.org.

ここも必見:Quarto PDFで共有

https://zenn.dev/shuntarosato/articles/e1ff406cbacc22

1-1. チャンク内 Option Tips

  • message: false はメッセージを消してくれる

  • echo: falseはコードを消してくれる(ここはtrue)かな

  • output: falseは実行結果を消してくれる

  • チャンク作成は「option+command+I」でショートカット

  • echo: fencedはチャンク内の#|を消す

  • code-line-numbers: true はスクリプトの行番号を示す

2)Data Penguins

2-1. データを読み込むパッケージ

library(tidyverse)
library(ggthemes)
library(palmerpenguins)
library(gt)

2-2. データの中身を確認する

penguins <- penguins %>% as_tibble()

colnames(penguins)

3)A scatter plot

Figure 1 The figure below is a scatter plot of species of penguins.

ggplot(
1  penguins,
  aes(
    
2    x = bill_length_mm, y = bill_depth_mm,
    color = species,shape = species
  )
)+
3  geom_point() +
  theme_minimal() + 
4  scale_color_colorblind() +
  labs(
    x = "bill_length(mm)",
    y = "bill_depth(mm)"
  )
1
データセットを指定
2
X軸,Y軸を指定
3
plotを指定
4
色のバリエーションを指定

スキャッタープロットを描くと強い線形との関連に気づく

Figure 1: スキャッタープロット描くリニアな関係

4)Penguins top 5 depict

Table 1 shows that the first 10 penguins from dataset.

penguins %>% slice_head(n = 5) %>% 
  select(
    species,island,bill_length_mm,bill_depth_mm
  ) %>% gt()
Table 1:

first 5 penguins.

species island bill_length_mm bill_depth_mm
Adelie Torgersen 39.1 18.7
Adelie Torgersen 39.5 17.4
Adelie Torgersen 40.3 18.0
Adelie Torgersen NA NA
Adelie Torgersen 36.7 19.3