Previous Topic

Next Topic

Book Contents

Book Index

Accessing PMOD R Variables

The structure of PMOD R variables is described above. A user may want to program scripts which address and process such variables. A list of functions can be obtained by simply typing "pm." into the command window. Moving the cursor over the list entries pops up a window with a syntax description and an example.

Another approach which is particularly helpful when beginning with scripts is using the extraction button

After selecting an entry, a dialog window is shown, in the case of Get row

When confirming the window, corresponding R code is generated
experiment = pm.getr("g1", "vt",c(1:13), 1, 3, 1.0);
which can be seen if the Execute box is not enabled.

Get vector

Allows extracting a TAC vector from a data structure:

R-GetVector

The name of the new variable is define in the Result variable field.

Get row

Allows extracting a row (Subject) from the selected statistic Part of the selected Aggregate variable:

R_GetRow

The name of the new variable is define in the Result variable field.

The OK button will execute the instruction that will appear in the Ouput window , for example:

Row = pm.getr("ControlsBaseline", "avr",c(1), 10, 3, 1.0);

It indicates that a new Result variable Row was created in the workspace.

With the VOI names box enabled the new variable will consist of the VOI specified column headers.

The VOI setting may consist of:

  • a single number, e.g. 1, indicating which VOI (column) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be stored as Result variable;
  • an interval range, e.g. 1:5, indicating which range of VOI (columns) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be stored as Result variable;
  • a combination of the above two separated by ",";
  • the symbol * indincating that all the VOI (columns) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be stored as Result variable;

Get column

Allows extracting a column (Subject) from the selected statistic Part of the selected Aggregate variable:

R-ExtractColumn

The name of the new variable is define in the Result variable field.

The OK button will execute the instruction that will appear in the Ouput window , for example:

Column = pm.getc("ControlsBaseline", "avr", 1,c(1:10), 3, 1.0);

It indicates a new Result variable Column was created in the workspace.

With the Subject names box enabled the new variable will consist of the specified Subject row names.

The Subject setting may consist of:

  • a single number, e.g. 1, indicating which Subject (row) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be stored as Result variable;
  • an interval range, e.g. 1:5, indicating which range of Subject (rows) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be stored as Result variable;
  • a combination of the above two separated by ",";
  • the symbol * , indincating that all the Subjects (rows) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be stored as Result variable;

Get matrix

Allows extracting a matrix from the selected statistic Part of the selected Aggregate variable:

R_ExtractMatrix

The name of the new variable is define in the Result variable field.

The OK button will execute the instruction that will appear in the Ouput window, for example:

Matrix = pm.getm('ControlsBaseline','avr', c(1:20), c(1:10), 3, c(1));

With the Convert into data frame box enabled the new variable will be converted into a data frame and an additional script line will appear:

Matrix= as.data.frame(Matrix, stringsAsFactors = FALSE);

The Subject and the VOI settings may consist of:

  • a single number, e.g. 1, indicating which VOI (column) and Subject (row) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be stored as Result variable;
  • an interval range, e.g. 1:5, indicating which range of VOI (columns) and Subject (row) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be stored as Result variable;
  • a combination of the above two separated by ",";
  • the symbol *, indincating that all the VOI (columns) and Subjects (rows) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be stored as Result variable;

Get part

Allows extracting the selected statistics Part from the Data aggregate available in the workspace:

R-GetPart

The name of the new variable is define in the Result variable field.

The OK button will execute the instruction that will appear in the Ouput window, for example:

Average = pm.getp("ControlsBaseline", "avr");

Get info

Allows extracting image information of the selected Subject from the selected Data aggregate:

R-GetInfo

The name of the new variable is define in the Result variable field.

The OK button will execute the instruction that will appear in the Ouput window, for example:

Info = pm.geti("ControlsBaseline", "avr",1);

Get filter

Allows extracting filter information for the selected Subject. The filters generally are defined during the aggregation process of the selected Data aggregate:

R_GetFilter

The name of the new variable is define in the Result variable field.

The OK button will execute the instruction that will appear in the Ouput window, for example:

Filter = pm.gete("ControlsBaseline", "avr",1);

Get external

Allows extracting external covariates, when available:

R-GetExt

This information can be extracted for a single subject or for All the subjects available in the selected Data aggregate variable.

The name of the new variable is define in the Result variable field.

The OK button will execute the instruction that will appear in the Ouput window, for example:

ExternalCovariates = pm.getAllX("Parametric_10s", "f_stress__flow_strs");

Get data frame

Allows extracting a Part of the selected Aggregate as a data frame:

R-GetDataFrame

The name of the new variable is define in the Result variable field.

The OK button will execute the instruction that will appear in the Ouput window, for example:

DataFrame = pm.getf("ControlsBaseline", "avr");

Set row

Allows setting new value(s) for the selected VOI and Subject in the selected Part of the active Data aggregate:

R-SetRow

The New data may be a Variable available in the workspace or an Expression.

The OK button will execute the instruction that will appear in the Ouput window, for example:

ControlsSmoothed = pm.setr("ControlsSmoothed", "avr", "Row",c(1:20), 1, 3, 1.0);

The VOI setting may consist of:

  • a single number, e.g. 1, indicating which VOI (column) of the selected Parameter (Name, Time or Value) in the Aggregate Part will be replaced by the New data.
  • an interval range, e.g. 1:5, indicating which range of VOI (columns) of the selected Parameter (Name, Time or Value) in the Aggregate Part will be replaced by the New data.
  • a combination of the above two separated by ",";
  • the symbol * indincating that the full content of the selected Parameter (Name, Time or Value) in the Aggregate Part will be replaced by the New Data.

Set column

It is similar to Set Row function and allows setting new values for the selected VOI and Subject:

R-SetColumn

The New data may be a Variable available in the workspace or an Expression.

The OK button will execute the instruction that will appear in the Ouput window, for example:

ControlsBaseline = pm.setc("ControlsBaseline", "hav", "Column", 1,c(1:10), 3, 1.0);

The Subject setting may consist of:

  • a single number, eg 1, indicating which Subject (row) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be replaced by the New data.
  • an interval range, eg 1:5, indicating which range of Subject (rows) of the selected Statistics (Name, Time or Value) in the Aggregate Part will be raplaced by the New data;
  • a combination of the above two separated by ",";
  • the symbol *, indincating that the full content of the selected Statistics (Name, Time or Value) in the Aggregate Part will be replaced by the New Data.

Set matrix

Allows setting new value(s) for the defined Column and Row in the selected Part of the active Aggregate:

R-SetMatrix

The New data may be a Variable available in the workspace or an Expression.

The OK button will execute the instruction that will appear in the Ouput window, for example:

ControlsBaseline <- pm.setm('ControlsBasline','avr', Matrix, c(1:3), c(1:3), 3, c(1));

The Column and Row settings may consist of:

  • a single number, eg 1, indicating which Column and Row of the selected Item (Name, Time or Value) in the Aggregate Part will be replaced by the New data.
  • an interval range, eg 1:5, indicating which range of Column and Row of the selected Item (Name, Time or Value) in the Aggregate Part will be replaced by the New Data.
  • a combination of the above two separated by ",";
  • the symbol *, indincating that the full content of the selected Item (Name, Time or Value) in the Aggregate Part will be replaced by the New Data.

Apply

Allows applying a mathematical Operation to the selected Agregate Part:

R-Apply

The Operation is defined by the selection of one of the Plus, Minus, Multiplied by, Divided by radio buttons.

The Operand should be a scalar variable already available in the workspace.

With the New part box enabled, a statistic part with the specified name, e.g. AVR_scaled, will be appended to the selected Aggregate file. Otherwise the curretly selected Part will be overwritten.

The OK button will execute the instruction that will appear in the Ouput window, for example:

ControlsBaseline = pm.aggApply('ControlsBaseline', 'avr', scale, operation = '/', newPart = 'AVR_scaled');

Sort

Allows sorting the Aggregate Part based on the selected Range criteria:

R-Sort

With the Descending order box enabled the sorting is performed accordingly.

The OK button will execute the instruction that will appear in the Ouput window, for example:

ControlsBaseline$avr = pm.sortc('ControlsBaseline', 'avr', desc=TRUE);

Mutual

Allows filtering the content of the first Aggregate Part based on the selected by criteria set for the Filtered by aggregate:

R-Mutual

The Input button allows assigning the result to the input aggregate part. Otherwise, a new variable will be created in the workspace with the name specified in the Result variable field.

The OK button will execute the instruction that will appear in the Ouput window, for example:

ControlsBaseline$avr = pm.mutualc('ControlsBaseline', 'avr', 'ControlsSmoothed', 'avr');

Copy column

Allows copying a column from the Source aggregate into the Destination aggregate:

R-CopyColumn

The OK button will execute the instruction that will appear in the Ouput window, for example:

ControlsBaseline = pm.copyColumns('ControlsSmoothed', 'avr', 'ControlsBaseline', 'avr',c(5));

The specified VOI(s)will be appended at the end of the selected Part in the Destination aggregate file.

Filter with NaN

Allows identifying the location of the NaN elements in the source Aggregate Part (where the below aggregtae is NA) and setting to NaN the corresponding elements in the destination aggregate (Set to NAs to the following aggregate)

R-FilterNaN

The Input button allows assigning the result to the destination aggregate part. Please note that in this situation the original content will be overwritten. Otherwise, a new variable will be created in the workspace with the name specified in the Result variable field.

The OK button will execute the instruction that will appear in the Ouput window, for example:

ControlsBaseline$avr = pm.filterWithNA('ControlsBaseline', 'avr', 'ControlsSmoothed', 'avr');