Title: | Functions to Import Data from 'z-Tree' into R |
---|---|
Description: | Read '.xls' and '.sbj' files which are written by the Microsoft Windows program 'z-Tree'. The latter is a software for developing and carrying out economic experiments (see <http://www.ztree.uzh.ch/> for more information). |
Authors: | Oliver Kirchkamp |
Maintainer: | Oliver Kirchkamp <[email protected]> |
License: | GPL-3 | file LICENSE |
Version: | 1.0.7 |
Built: | 2025-02-15 04:54:47 UTC |
Source: | https://github.com/cran/zTree |
Read '.xls' and '.sbj' files which are written by the Microsoft Windows program 'z-Tree'. The latter is a software for developing and carrying out economic experiments (see <http://www.ztree.uzh.ch/> for more information).
The DESCRIPTION file:
Package: | zTree |
Type: | Package |
Title: | Functions to Import Data from 'z-Tree' into R |
Version: | 1.0.7 |
Date: | 2021-11-03 |
Author: | Oliver Kirchkamp |
Maintainer: | Oliver Kirchkamp <[email protected]> |
Description: | Read '.xls' and '.sbj' files which are written by the Microsoft Windows program 'z-Tree'. The latter is a software for developing and carrying out economic experiments (see <http://www.ztree.uzh.ch/> for more information). |
License: | GPL-3 | file LICENSE |
Depends: | R (>= 3.1.0) |
Imports: | plyr (>= 1.0) |
NeedsCompilation: | no |
Packaged: | 2021-11-03 15:40:49 UTC; oliver |
Date/Publication: | 2021-11-03 16:10:02 UTC |
Repository: | https://kirchkamp.r-universe.dev |
RemoteUrl: | https://github.com/cran/zTree |
RemoteRef: | HEAD |
RemoteSha: | a5af9e568fb86860375e64e998016638f811e42d |
Index of help topics:
toLongDate Converts short (old) 'z-Tree' dates into long (new) 'z-Tree' dates. zTree-package Functions to Import Data from 'z-Tree' into R zTreeSbj Read '.sbj' files generated by 'z-Tree' into R zTreeTables Read '.xls' files generated by 'z-Tree' into R
Oliver Kirchkamp Maintainer: Oliver Kirchkamp <[email protected]>
Urs Fischbacher. "z-Tree: Zurich Toolbox for Ready-made Economic Experiments." Experimental Economics (2) 171-178, 2007.
Oliver Kirchkamp. "Importing z-Tree data into R." Journal of Behavioral and Experimental Finance (22), 1-2, 2019.
## Not run: zTT <- zTreeTables(c("080712_1412.xls","080712_1818.xls")) ## End(Not run)
## Not run: zTT <- zTreeTables(c("080712_1412.xls","080712_1818.xls")) ## End(Not run)
Old versions of 'z-Tree' stored dates as, e.g. 050613JN (the first six being year-month-date, the last two characters are the time). Newer versions use strings like 091112_1600 (time is now in the last four characters). This function converts the old format into the new format
toLongDate(shortDate)
toLongDate(shortDate)
shortDate |
This should be a vector of strings, each of length 8 characters.
The first six characters of each element of |
A vector of the same length as shortDate
. The first six
characters of each element are unchanged. The last five characters are
now the time translated.
Oliver Kirchkamp
Urs Fischbacher. "z-Tree Manual 2.1 Experimenter's Manual". Zurich. 2002.
toLongDate("091112JN")
toLongDate("091112JN")
Read '.sbj' files which are written by the Microsoft Windows program 'z-Tree'. The latter is a software for developing and carrying out economic experiments (see <http://www.ztree.uzh.ch/> for more information).
zTreeSbj(files, sep = "\t", zTree.silent=getOption("zTree.silent"), zTree.encoding=getOption("zTree.encoding"),ignore.errors=FALSE)
zTreeSbj(files, sep = "\t", zTree.silent=getOption("zTree.silent"), zTree.encoding=getOption("zTree.encoding"),ignore.errors=FALSE)
files |
A vector of 'z-Tree' .sbj filenames |
sep |
'z-Tree' uses "\t" as a separator. If you have a manipulated file, you might need to change the separator. |
zTree.silent |
If |
zTree.encoding |
zTree writes text files and seems to use latin1 (windows-1252) encoding for these files. |
ignore.errors |
Usually, |
A data frame with one entry for each subject.
Oliver Kirchkamp
Urs Fischbacher. "z-Tree: Zurich Toolbox for Ready-made Economic Experiments." Experimental Economics (2) 171-178, 2007.
See also zTreeTables
## Not run: files <- list.files(pattern = "*.sbj$",recursive=TRUE) fname <- sub(".*/","",files) sbj <- zTreeSbj(aggregate(files,list(fname),function(x) x[1])$x) ## End(Not run)
## Not run: files <- list.files(pattern = "*.sbj$",recursive=TRUE) fname <- sub(".*/","",files) sbj <- zTreeSbj(aggregate(files,list(fname),function(x) x[1])$x) ## End(Not run)
Read '.xls' files which are written by the Microsoft Windows program 'z-Tree'. The latter is a software for developing and carrying out economic experiments (see <http://www.ztree.uzh.ch/> for more information).
zTreeTables(files, tables = c("globals", "subjects"), sep = "\t", zTree.silent=getOption("zTree.silent"), zTree.encoding=getOption("zTree.encoding"),ignore.errors=FALSE)
zTreeTables(files, tables = c("globals", "subjects"), sep = "\t", zTree.silent=getOption("zTree.silent"), zTree.encoding=getOption("zTree.encoding"),ignore.errors=FALSE)
files |
a vector of 'z-Tree' (xls-) filenames. |
tables |
a vector of table names. If you leave this empty, globals and subjects will be read. If you set tables=NULL, all tables will be read. |
sep |
Field separator. 'z-Tree' uses "\t" as a separator. If you have a manipulated file, you might need to change the separator. |
zTree.silent |
If |
zTree.encoding |
zTree writes text files and seems to use latin1 (windows-1252) encoding for these files. |
ignore.errors |
Usually, |
A list of all tables (e.g. "globals", "subjects", etc.)
Oliver Kirchkamp
Urs Fischbacher. "z-Tree: Zurich Toolbox for Ready-made Economic Experiments." Experimental Economics (2) 171-178, 2007.
See also zTreeSbj
## Not run: zTT <- zTreeTables(c("080712_1412.xls","080712_1818.xls")) with(zTT$subjects, table(Treatment,Period)) To read all tables from all sessions in directories below the current one: sessions<-list.files(".","[0-9]{6}_[0-9]{4}.xls",recursive=TRUE) zTT<-zTreeTables(sessions,tables=NULL) ## End(Not run)
## Not run: zTT <- zTreeTables(c("080712_1412.xls","080712_1818.xls")) with(zTT$subjects, table(Treatment,Period)) To read all tables from all sessions in directories below the current one: sessions<-list.files(".","[0-9]{6}_[0-9]{4}.xls",recursive=TRUE) zTT<-zTreeTables(sessions,tables=NULL) ## End(Not run)