new_column()

new_column()

new_column(name, *codes)

Creates a new blank column with the specified name and codes.

Parameter

Type

Description

name

String

The name of the new column

codes

comma separated Strings

Codes that the new column will contain.

Note

new_column() creates the onset, offset, and ordinal codes by default. You do not need to specify them in the codes.

Returns

Ruby object representation of the new column in Datavyu.

Example

The following example creates a new Datavyu column called “trial” with the codes “trialnum” and “unit”, and assigns them to an RColumn object called trial. It then adds a new cell to trial using new_cell() and writes the changes back to the Datavyu spreadsheet using set_column().

require 'Datavyu_API.rb'
begin
   trial = new_column('trial', 'trialnum', 'unit')
   trial.new_cell()
   set_column(trial)
end