1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RのSave workspace image? [y/n/c]: y は何処へ?

Posted at

RのSave workspace image? [y/n/c]でy(はい)とするとどこに保存されるのか気になったので調べてみました。

R
> q()
Save workspace image? [y/n/c]: 

y(はい)と答えた場合、
作業スペースの内容がRのworking directoryの .RData というファイルに保存され,次回の起動時に自動的に読み込まれる。y でも n でも,打ち込んだコマンドの履歴が作業ディレクトリの .Rhistory というファイルに入る。

% ls
% ls -a
.		..		.RData		.Rhistory

.RDataと.Rhistoryファイルは隠しファイルなので、通常は見えない。

MacのFinderで隠しファイルを表示するショートカットキーは
「command」+「shift」+「.」
これでFinderでも可視化することができる。

プロジェクトごとに異なる作業ディレクトリを指定すれば、ディレクトリごとに異なる .RData と .Rhistoryファイルが作成される。Rで読み込むと作業スペースに保存された作業内容が継続利用できるらしい。

以下は覚書

y(はい) → 作業スペース(現在の状態)を保存して終了
n(いいえ) → 保存しないで終了
c(キャンセル) → 終了をキャンセルする(終了しない)

通常は n(いいえ)でOK.

作業スペース .RData と履歴 .Rhistory の使い方

起動時に作業ディレクトリの作業スペース .RData と履歴 .Rhistory を読み込むと前回の状態が復元できる。

以上です。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?