LoginSignup
1
1

個人的によく使うコードまとめ(R ver.)

Last updated at Posted at 2023-10-05

準備

フォルダの作成

#パッケージのダウンロード
library(fs)
library(here)
# 作業ディレクトリ名やフォルダ名を示す
here::here() 
fs::dir_create(   # 作業ディレクトリ内に複数のフォルダを作成する.
  here::here(
    c("figure",   # 図
      "table",    # 表
      "script",   # スクリプト
      "qmd",   # quartoのqmdファイル
      "data",   # データ
      "document",   # 論文に必要な資料の保存
      "manuscript",   # 原稿
      "submit")    # 提出用ファイルをまとめる  
    )
  )

# 図を保存する時のパス
here::here("figure") 

データの出力

# 作成したオブジェクトをdataフォルダに保存
save(a, b,    # 保存したいオブジェクト
     file = here::here("data", "02_objects.RData"))

# 作成した関数についてのデータを読み込む
load(file = here::here("data", "02_objects.RData"))

データの読み込み

データの確認

前処理

1
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
1
1