class.analysis_object: 'CAB' Analysis Objects

Description Usage Details Slots UOA_analysis_object Custom analysis object Analysis objects from simulations Examples

Description

analysis_object are objects for data analysis.

Usage

1
2
3
4
5
6
set.custom_analysis_object(class_name, slot_names)

make.custom_analysis_object(analysis_obj_class, ...)

make.simulation_analysis_object(meta_data, input, dims,
  data = data.frame(NULL))

Details

In the CAB package, data is typically stored in an analysis_object of which there are multiple child classes. analysis_objects are created by running a simulation or by importing some experimental data.

The parent class analysis_object does not really do anything. The real work is done by other classes that inherit from analysis_object.

Slots

analysis_object

A data.frame that contains the data.

meta_data

A list that contains the information about the experiment or simulation.

UOA_analysis_object

The UOA_analysis_object class is made specially for the MED-PC files used at the University of Auckland.

Slots

variable_arrays

A list that stores arrays that contains variable information, such as the number of responses or the number of reinforcement (i.e., a "C"-array).

general_arrays

A list that stores arrays that contain general information, such as the arranged inter-reinforcement intervals.

meta_data

Inerited from analysis_object. A data.frame that contains the metadata for the experiment.

analysis_object

Inherited from analysis_object. A data.frame that contains the events and the times. This will be some post-processed "X"-array.

Custom analysis object

If the user wishes to make their own analysis_object class, the set.custom_analysis_object() function can be used to set up the class.

To create an object of the newly set up analysis_object class, the make.custom_analysis_object() function can be used. In general, once a custom analysis_object class is defined, other functions, such as those that read in the data, will construct objects of the custom analysis_object class. Hence, the user will rarely have to use the make.custom_analysis_object() function directly.

Usage

set.custom_analysis_object( class_name, slot_names )

Mandatory slots

analysis_object

Inherited from analysis_object.

meta_data

Inherited from meta_data.

Arguments

class_name

A character string giving the name of the custom analysis_object class.

slot_names

Either: 1) an unnamed list of slot names or 2) a named list, with the names specifying the slot names and the elements specifying the class of object contained in the slot. If 1), all slots will contain list. See example.

Usage

make.custom_analysis_object( analysis_obj_class, ... )

Arguments

analysis_object_class

A character string specifying the name of the custom analysis_object class.

...

A named set of arguments that fills up the object. The arguments should be named as the slot name to which the argument pertains to. See example.

Analysis objects from simulations

By default, simulations will store the data in a simulation_analysis_object object.

Usage

make.simulation_analysis_object( class_name, slot_names )

Slots

analysis_object

Inherited from analysis_object. Defaults to data.frame(NULL) so that only the input slot contains simulation data.

meta_data

Inherited from analysis_object.

input

Inherited from sim_input.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Make a custom "analysis_object"
# With an unnamed list:
set.custom_analysis_object( class_name = "test_analysis", slot_names = list( "slot1", "slot2" ) )
# The "slot_names" is an unnamed list, so "slot1" and "slot2" will only hold "list".
make.custom_analysis_object( analysis_object_class = "test_analysis", slot1 = list(1), slot2 = list(2) )

# With a named list:
set.custom_analysis_object( class_name = "test_analysis", slot_names = list( slot1 = "data.frame", slot2 = "character" ) )
# The "slot_names" is a named list, with elements "data.frame" and "character". So, "slot1" will hold "data.frame" and "slot2" will hold "character".
make.custom_analysis_object( "test_analysis", slot1 = data.frame(1), slot2 = "a" )

Don-Li/CAB_original documentation built on May 6, 2019, 2:53 p.m.