Announcing the new Datavyu v1.4.0 with enhanced features, bug fixes, and a new video player for Windows!

We are in the process of migrating away from this forum—feel free to browse existing help topics. For new support inquiries, please reach out to us via email at

I have coded the onset and offset of participants' speaking time in one column ("talktime"). In another column ("task") I have coded the onset and offset of different tasks during the study. I would like to add up all of the time talked during each task (for example, so that I know the participant talked 25 seconds during Task 1 and 45 seconds during Task 2) and either export this directly or create a new column that I can then export. Is this possible?

asked 06 Mar, 18:45

katethorson's gravatar image

accept rate: 0%

We recommend users to export their data and do aggregations outside of Datavyu. You can use this ( template script to export data such that the talktime cells are nested inside of the task cells (long format). You would want to set the nested_columns parameter to %w(task talktime) and update the code_map parameter with the appropriate column names and codes. If you have a column with metadata information about the file (e.g., "id"), you can specify it in the static_columns parameter to have it repeated for the entire file.

You can export summary statistics using a Ruby script, but that requires more legwork. See this post for an example: .

Here's an example of what your export script may look like:

task_col = get_column('task')
talk_col = get_column('talktime')

data = [] task_col.cells.each do |taskcell| talkcells ={ |x| taskcell.contains(x) } # Sum up durations of nested talktime cells talk_dur =, :+) task_dur = taskcell.duration data << [task_dur, talk_dur].join(',') end

Print the data to the console

puts data

The data array would contain a CSV row for each task cell. The first value would be the duration of the task (in milliseconds) and the second value would the the total duration of nested talktime cells within that task. The selection statement in the code requires a strict nesting: the talk cell must start at-or-after the task cell and must end at-or-before the task cell.

permanent link

answered 06 Mar, 21:24

Shohan%20Hasan's gravatar image

Shohan Hasan ♦♦
accept rate: 14%

What do you recommend if the cells don't have a strict nesting? I found this to be difficult to deal with when outside of Datavyu so I was hoping there was some way I could manage it in Datavyu. The ComboExport script won't work for this reason, I think (error message: "Can't find nesting cell in column interval30sec for cell 2 in column talktime" - this cell begins in one interval and ends in the next). And it sounds like exporting summary statistics via Ruby will also require a strict testing. Do you have any suggestions?

(07 Mar, 13:15) katethorson katethorson's gravatar image

Depends on your coding pass. If you don't care about strict nesting and it doesn't happen often, you could assign the cell to one of the overlapping intervals (e.g., majority wins). There are RCell functions that let you check amount of overlap between two cells (if any).

Another option is the merge the two columns together to create a single column containing all the codes from the source columns. Cells would be inserted for each change in any of the codes. This is usually the best way to handle exporting since it preserves the coded information and you can process it outside of Datavyu.

(08 Mar, 13:52) Shohan Hasan ♦♦ Shohan%20Hasan's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 06 Mar, 18:45

question was seen: 403 times

last updated: 08 Mar, 13:52

powered by OSQA