パッケージを使用して R で回帰テーブルを作成し始めたばかりですが、フローティング環境またはドキュメント環境 (およびドキュメント環境の場合はプリアンブル)なしstargazer
でテーブル出力を .tex ファイルに書き込む方法がわかりません。つまり、表形式の環境が必要なだけです。私のワークフローは、表のフローティング環境 (および関連するキャプションとラベル) を紙の本文に保持し、表の表形式の環境に.\input{}
これは可能ですか?
# bogus data
my.data <- data.frame(y = rnorm(10), x = rnorm(10))
my.lm <- lm(y ~ x, data=my.data)
# if I write to file, then I can omit the floating environment,
# but not the document environment
# (i.e., file contains `\documentclass{article}` etc.)
stargazer(my.lm, float=FALSE, out="option_one.tex")
# if I write to a text connection with `sink`,
# then I can omit both floating and document environments,
# but not commands
# (i.e., log contains `sink` and `stargazer` commands)
con <- file("option_two.tex")
sink(con)
stargazer(my.lm, float=FALSE)
sink()