在 R 中读取 zTee 主题文件

reading zTee subject files in R

我想将 zTree 主题数据文件(问卷)导入 R,我正在使用 zTreeSbj function written by Oliver Kirchkamp:

files <- list.files(pattern = "*.sbj$",recursive=TRUE)
fname <- sub(".*/","",files)
sbj <- zTreeSbj(aggregate(files,list(fname),function(x) x[1])$x)

我收到以下错误:

reading  1 ...
Error in file(filename, "r", encoding = getOption("zTree.encoding")) : 
invalid 'description' argument
Called from: file(filename, "r", encoding = getOption("zTree.encoding"))    

我遇到了同样的问题,Oliver Kirchkamp 回复我:

In your case you do not need aggregate. Simply say:

files <- list.files(pattern = "*.sbj$",recursive=TRUE)
sbj <- zTreeSbj(files)

这对我有用,因为我没有同一个 .sbj 文件的多个版本。