Announcing the new Datavyu v1.3.6 with enhanced features and transcription support!


I am using a mutex column and want to export only very specific cells from that column. In essence I want to export the cells for which the comparison column does not have corresponding cells (I am looking for percent disagreement). Is there a simple way to do this?

Thank you.

asked 06 Jan '16, 14:13

bmcgee's gravatar image

accept rate: 0%

The mutex column contains the codes from the original columns renamed using the following format:

column_name + "_" + code_name

Cells which contain blanks (i.e. "") for a specific code means that one of the original columns did not have a value for that code (or that the original code was also blank). You could use this to do your check.

For example, let's say you have two columns, "trial" and "trial_2", with a single code "cond" that you merge into third column "trial_mutex". You can perform the check using the following code:

mutex_col = create_mutually_exclusive('trial_mutex', 'trial', 'trial_2')

disagree_duration = 0 total_duration = 0 for cell in mutex_col.cells if( (cell.trial_cond == '') ^ (cell.trial_2_cond == '') ) # ^ is the xor operator; true when operands disagree disagree_duration += cell.offset - cell.onset + 1 end total_duration += cell.offset - cell.onset + 1 end

I hope this is helpful; feel free to ask if you need clarifications.

permanent link

answered 06 Jan '16, 19:39

Shohan%20Hasan's gravatar image

Shohan Hasan ♦♦
accept rate: 12%

alt text Thank you for your response Shohan. I have uploaded a jpeg (which I should have done originally!) to help clarify my question. I already have the mutually exclusive column, in the image it is titled "Lexi_Liat" I want to compare that column to the column titled "Box_Infant_Touch_LC" ... the black boxes that I've painted in are examples of times in which the coders were in disagreement (this is in temporal view). When they are in disagreement, I want to export the corresponding cells from the mutex column. Does this make sense? Any input is greatly appreciated! Thank you again.

permanent link

answered 07 Jan '16, 12:53

bmcgee's gravatar image

accept rate: 0%

The quick solution is to compare box_infant_touch_lj_ordinal against box_infant_touch_lc_ordinal. If either is blank you can print out the cells.

BTW, I think the coder in Box_Infant_Touch_LC actually typed out "<touch>" instead of leaving the code blank. You can see this when you look at the mutex column. When the cell doesn't exist, it correctly shows "<box_infant_touch_lc_code01>" because the code is empty (i.e. ""). However, when the cell does exist, the code changes. This behavior is not present for Box_Infant_Touch_LJ. I would suggest just leaving the code field blank.

(07 Jan '16, 13:32) Shohan Hasan ♦♦ Shohan%20Hasan's gravatar image

Yes, thank you absolutely. What would be the correct way to code for if either is blank to print out the cells in question?

permanent link

answered 07 Jan '16, 13:39

bmcgee's gravatar image

accept rate: 0%

Try something like this:

## Params
column_name = "Lexi_Liat"
output_file_path = "~/Desktop/output.csv"

## Body
col = getVariable(column_name)

# Filter out disagreement cells
disagreeCells ={ |cell| (cell.box_infant_touch_lj_ordinal == '') ^ (cell.box_infant_touch_lc_ordinal == '') }

# For debugging, show the cells in the console
p disagreeCells

# Open output file
outfile = File.expand_path(output_file_path), "w+" )

# Loop over the disagreement cells and print to outputfile
for cell in disagreeCells
  outfile.puts ( [cell.onset, cell.offset] +{ |arg| cell.get_arg(arg)} ).join(',')


Please refer to the API reference for more information regarding scripting: Datavyu Ruby API

permanent link

answered 07 Jan '16, 14:02

Shohan%20Hasan's gravatar image

Shohan Hasan ♦♦
accept rate: 12%

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 Jan '16, 14:13

question was seen: 2,771 times

last updated: 07 Jan '16, 14:02

powered by OSQA