【发布时间】:2013-10-02 18:15:42
【问题描述】:
我正在使用testthat 来测试具有类似于以下文件树的包:
.
├── data
│ └── testhaplom.out
├── inst
│ └── test
│ ├── test1.r
│ ├── tmp_S7byVksGRI6Q
│ │ └── testm.desc
│ └── tmp_vBcIkMN1arbn
│ ├──testm.bin
│ └── testm.desc
├── R
│ ├── haplom.r
│ └── winIdx.r
└── tmp_eUG3Qb0PKuiN
└── testhaplom.hap2.desc
在test1.r文件中,我需要使用data/testhaplom.out文件作为某个函数的输入数据,但是如果我这样做test_file(test1.r),它会变成inst/test目录,并且看不到数据文件,给出以下错误:
...Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'data/testhaplom.out': No such file or directory
【问题讨论】: