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: 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: 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:
|
Get column |
Allows extracting a column (Subject) from the selected statistic Part of the selected 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: 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:
|
Get matrix |
Allows extracting a matrix from the selected statistic Part of the selected 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: 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:
|
Get part |
Allows extracting the selected statistics Part from the Data aggregate available in the workspace: 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: 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: 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: 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: 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: 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:
|
Set column |
It is similar to Set Row function and allows setting new values for the selected VOI and Subject: 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:
|
Set matrix |
Allows setting new value(s) for the defined Column and Row in the selected Part of the active Aggregate: 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:
|
Apply |
Allows applying a mathematical Operation to the selected Agregate Part: 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: 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: 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: 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) 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'); |