将minitab文件导入R时出错

时间:2019-09-04 20:38:41

标签: r import mtp

我在R中使用外部程序包来导入MTP文件,但它仅显示文件读取错误。我已经设置了默认目录,但是它不起作用。如果能得到帮助,我将不胜感激。预先谢谢你。

library(foreign)

d44<-read.mtp("PERAGGR.MTP")

Here is the file that I was using

1 个答案:

答案 0 :(得分:0)

read.mtp函数非常古老。由于该文件实际上是ASCII文件,因此只需使用`readLines:

进行读取
d44<-readLines("~/Downloads/PERAGGR.MTP")
head(d44)
# ============== top of output==================
[1] "Minitab Portable Worksheet P1.1             2007 523 Rel    15.0               ."
[2] "%      3      1    109      0 Study                                            ."
[3] " 1.000000000E+00 2.000000000E+00 3.000000000E+00 4.000000000E+00 5.000000000E+00"
[4] " 6.000000000E+00 7.000000000E+00 8.000000000E+00 9.000000000E+00 1.000000000E+01"
[5] " 1.100000000E+01 1.200000000E+01 1.300000000E+01 1.400000000E+01 1.500000000E+01"
[6] " 1.600000000E+01 1.700000000E+01 1.800000000E+01 1.900000000E+01 2.000000000E+01"