This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 3D animated map from DEM | |
| library(terra) | |
| library(ggplot2) | |
| library(geometry) | |
| library(ggcube) | |
| # Load DEM data from GeoTIFF | |
| # 国土地理院基盤地図情報数値標高モデル(DEM10B)を使用 | |
| geotiff_file <- "data/543654.tif" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Plot DEM data using ggcube | |
| library(terra) | |
| library(ggplot2) | |
| library(geometry) | |
| library(ggcube) | |
| # Load DEM data from GeoTIFF | |
| # 国土地理院基盤地図情報数値標高モデル(DEM5A)を使用 | |
| geotiff_file <- "data/543654.tif" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Mexican hat using ggcube | |
| # | |
| # https://tororolab.hatenablog.com/entry/2024/12/16/225348 | |
| library(ggplot2) | |
| library(ggcube) | |
| fun <- function(x, y) { | |
| r <- sqrt(x^2 + y^2) | |
| 1.5 * cos(r) - 0.75 * cos(3 * r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ggplot2) | |
| library(palmerpenguins) | |
| point_plot <- function(d, x, y) { | |
| ggplot(d) + | |
| geom_point(aes(x = .data[[x]], y = .data[[y]])) | |
| } | |
| (var_names <- colnames(penguins)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 『たのしいベイズモデリング2』第5章のRコード | |
| # CmdStanR版 | |
| # R 4.3.1 Mac, Stan 2.23.2, CmdStanR 0.5.3 で動作確認 | |
| library(readxl) | |
| library(dplyr) | |
| library(cmdstanr) | |
| options(mc.cores = parallel::detectCores()) | |
| # データファイルのURL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(sf) | |
| library(tmap) | |
| # 参考にしたところ | |
| # https://qiita.com/ocean_f/items/700aff67f3e35266b0fe | |
| # 国土数値情報からデータをダウンロード | |
| # https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N03-v3_1.html | |
| datafile <- file.path("data", "N03-20230101_01_GML", | |
| "N03-23_01_230101.geojson") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "Zero-inflated beta regression" | |
| output: html_notebook | |
| --- | |
| ## Setup | |
| ```{r setup} | |
| library(ggplot2) | |
| library(zoib) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "Beta regression" | |
| output: html_notebook | |
| --- | |
| ## Setup | |
| ```{r setup} | |
| library(ggplot2) | |
| library(betareg) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "R Notebook" | |
| output: html_notebook | |
| --- | |
| ## An example of likelihood ratio tests in R | |
| ```{r setup} | |
| library(lmtest) | |
| library(palmerpenguins) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "R Notebook" | |
| output: html_notebook | |
| --- | |
| ## An example to use glht function in the multcomp package | |
| ```{r setup} | |
| library(multcomp) | |
| library(palmerpenguins) |
NewerOlder