Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Rでシェルスクリプトを実行することは、システムコマンドを使用していることを知っています:
my.table <- system(command,intern=TRUE)
ただし、「コマンド」の結果がテーブルを出力することであり、Rにテーブルを独自のデータ構造に直接読み取らせたい場合。(データフレームのようなもの)それを行う簡単な方法はありますか?「テーブル」の現在の出力は文字列テーブルであるためです。私が欲しいのは、read.table() としてのRオブジェクトです。
結果の「テーブル」に行をマークするための空白区切りと改行がある場合は、結果を read.table の「テキスト」引数に渡す必要があります。
inp.tbl <- read.table(text = system(command,intern=TRUE) )
を使用pipeすると、よりもメモリと時間が効率的になるとsystem思いますintern
pipe
system
intern
inp.tbl <- read.table(pipe(command) )