Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/psychopy/psychopy
Browse files Browse the repository at this point in the history
  • Loading branch information
peircej committed Sep 21, 2018
2 parents 18a3db5 + f5b08af commit 5200e79
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion psychopy/data/experiment.py
Expand Up @@ -252,7 +252,8 @@ def saveAsWideText(self,
matrixOnly=False,
appendFile=False,
encoding='utf-8',
fileCollisionMethod='rename'):
fileCollisionMethod='rename',
sortColumns=False):
"""Saves a long, wide-format text file, with one line representing
the attributes and data for a single trial. Suitable for analysis
in R and SPSS.
Expand Down Expand Up @@ -291,6 +292,9 @@ def saveAsWideText(self,
Collision method passed to
:func:`~psychopy.tools.fileerrortools.handleFileCollision`
sortColumns:
will sort columns alphabetically by header name if True
"""
# set default delimiter if none given
if delim is None:
Expand All @@ -306,6 +310,9 @@ def saveAsWideText(self,
names.extend(self.dataNames)
# names from the extraInfo dictionary
names.extend(self._getExtraInfo()[0])
# sort names if requested
if sortColumns:
names.sort()
# write a header line
if not matrixOnly:
for heading in names:
Expand Down

0 comments on commit 5200e79

Please sign in to comment.