LoginSignup
2
1

More than 3 years have passed since last update.

Shiny で SEIR モデルを表示する

Last updated at Posted at 2020-08-25

こちらにあるSEIR モデルを Shiny で表示してみました。
感染症数理モデル;Sequential SEIR model

プログラムはこちらです。
SEIR.zip

Ubuntu 20.04 で確認しました。

R がインストールしてある状況で、
1) ライブラリーのインストール

sudo apt install r-cran-desolve

2) Shiny-Server のインストール

こちらの記事を参考にしました。
【R】Shiny-Serverのインストール
Download Shiny Server for Ubuntu 16.04 or later

Shiny-Server が動いていることの確認

sudo systemctl status shiny-server

http://localhost:3838/ にアクセス
shiny_aug25_aa.png

http://localhost:3838/sample-apps/hello/ にアクセス
shiny_aug25_bb.png

Shiny-Server の設定ファイル

/etc/shiny-server/shiny-server.conf
# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# Define a server that listens on port 3838
server {
  listen 3838;

  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

3) /opt/shiny-server/samples/sample-apps に SEIR.zip を解凍して置く

$ tree sample-apps/
sample-apps/
├── SEIR
│   ├── server.R
│   └── ui.R
├── hello
│   ├── server.R
│   └── ui.R
└── rmd
    └── index.Rmd

4) http://localhost:3838/sample-apps/SEIR/ にアクセスして、Submit ボタンをクリック
seir_aug25_cc.png

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1