I want to import zTree subjects data files (quetionaire) to R and I am using 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)
I get the following error:
reading 1 ...
Error in file(filename, "r", encoding = getOption("zTree.encoding")) :
invalid 'description' argument
Called from: file(filename, "r", encoding = getOption("zTree.encoding"))
I had the same problem, and Oliver Kirchkamp replied to me:
In your case you do not need aggregate. Simply say:
files <- list.files(pattern = "*.sbj$",recursive=TRUE) sbj <- zTreeSbj(files)
That worked for me, because I did not have multiple versions of the same .sbj file.