我正在尝试使用“保存命令”将 stata 文件保存为 R 文件,但反复出现错误:
>library(foreign)
# read stata file (there is a stata file "data.dta" in working directory)
>read.dta("data.dta")
var1 var2 var3 var4 var5
1 -4.239497 0.2406101 3.786384 -1.3025404 0.3428481
2 -3.311914 1.9533381 3.200867 -2.4428566 0.9154460
3 -2.156078 1.6590545 4.317356 -3.1660178 1.6963958
4 2.648022 -1.4091060 3.227258 -0.9857693 1.4566656
>getwd()
"C:/Users/Vista/Documents"
>save(data.dta, file = "data.rda")
Error in save(data.dta, file = "data.rda") : object 'data.dta' not found
在这方面的建议将不胜感激。