| 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 <oliver@kirchkamp.de> |
| 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 |
| Repository: | CRAN |
| Date/Publication: | 2021-11-03 16:10:02 UTC |
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).
Details
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 <oliver@kirchkamp.de> |
| 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) |
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
Author(s)
Oliver Kirchkamp Maintainer: Oliver Kirchkamp <oliver@kirchkamp.de>
References
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.
Examples
## Not run:
zTT <- zTreeTables(c("080712_1412.xls","080712_1818.xls"))
## End(Not run)
Converts short (old) 'z-Tree' dates into long (new) 'z-Tree' dates.
Description
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
Usage
toLongDate(shortDate)
Arguments
shortDate |
This should be a vector of strings, each of length 8 characters.
The first six characters of each element of |
Value
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.
Author(s)
Oliver Kirchkamp
References
Urs Fischbacher. "z-Tree Manual 2.1 Experimenter's Manual". Zurich. 2002.
Examples
toLongDate("091112JN")
Read '.sbj' files generated by 'z-Tree' into R
Description
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).
Usage
zTreeSbj(files, sep = "\t", zTree.silent=getOption("zTree.silent"),
zTree.encoding=getOption("zTree.encoding"),ignore.errors=FALSE)
Arguments
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, |
Value
A data frame with one entry for each subject.
Author(s)
Oliver Kirchkamp
References
Urs Fischbacher. "z-Tree: Zurich Toolbox for Ready-made Economic Experiments." Experimental Economics (2) 171-178, 2007.
See Also
See also zTreeTables
Examples
## 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 generated by 'z-Tree' into R
Description
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).
Usage
zTreeTables(files, tables = c("globals", "subjects"), sep = "\t",
zTree.silent=getOption("zTree.silent"),
zTree.encoding=getOption("zTree.encoding"),ignore.errors=FALSE)
Arguments
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, |
Value
A list of all tables (e.g. "globals", "subjects", etc.)
Author(s)
Oliver Kirchkamp
References
Urs Fischbacher. "z-Tree: Zurich Toolbox for Ready-made Economic Experiments." Experimental Economics (2) 171-178, 2007.
See Also
See also zTreeSbj
Examples
## 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)