インタラクティブな解析共有ライフ

1)Quarto(クオート)

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

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

1-1. チャンク内 Option Tips

  • message: false はアウトプットを消してくれる

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

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

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

  • echo: fencedはチャンク内の指定を表示 注釈するにはfalse

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

2)Data Penguins

2-1. データを読み込むパッケージ
Code
library(tidyverse)
library(ggthemes)
library(palmerpenguins)
library(gt)
2-2. データの中身を確認する
Code
penguins <- penguins %>% as_tibble()

colnames(penguins)

3)A scatter plot

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

Code
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.

Code
```{r}
#| label: tbl-penguins-top10
#| tbl-cap: first 5 penguins.

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