import_medpc_to_UOA: Import data from Med-PC to a 'UOA_analysis_object'

Description Usage Arguments Details See Also Examples

Description

import_medpc_to_UOA is a function for importing data from MED-PC backup files into a list UOA_analysis_objects and an associated list of meta data.

Usage

1
2
3
import_medpc_to_UOA(partial_file_name, variable_arrays = NULL,
  event_arrays = NULL, general_arrays = NULL, file_path = NULL,
  precision = NULL)

Arguments

partial_file_name

A string that specifies a partial file name. The import_medpc_to_UOA function searches through a directory for all files that match the (partial) file name.

variable_arrays

A nested list. At the first level, a named list specifying the name of the array that is recorded in MED-PC. At the second level, the array indices that are associated with the elements of the array. Defaults to NULL.

event_arrays

A nested list. At the first level, a named list specifying the name of the array that is recorded in MED-PC. At the second level, the event codes that are associated with the elements of the array. Defaults to NULL.

general_arrays

A one-level list. The names of each element should correspond to the arrays that are recorded in MED-PC. Each element should be a name describing what that array is recording. Defaults to NULL.

file_path

A string specifying the file path for partial_file_name. Defaults to NULL, which uses the current working directory.

precision

The number of decimal places to round the data. Defaults to NULL for no rounding. Rounding is recommended to avoid integer under/overflow.

Details

In the event array, it is assumed that each event is recorded as a number. The leading values of the event should correspond to some event. The trailing values should correspond to the time at which an event occurred. For example, let 9000000 indicate a response and let 1320 be the number of seconds at which a response occurred. The event would then be recorded as 9001320.

The import_medpc_to_UOA function processes the event numbers from the MED-PC backup files and splits them into an event-time data frame. This is done by figuring out the multiple of 10 on which the events are recorded with floor( log( event_array[1], 10 ). Hence, problems will arise if the first value in the MED-PC event vector is 0. The time associated with each event is obtained by the remainder of the quotient of the event number and the event code multipled by the appropriate power of 10.

See Also

class.analysis_object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#Suppose that our file path is "F:/Dropbox/Don/bird_data/vi_15"
file_path = "F:/Dropbox/Don/bird_data/vi_15"

#Suppose that all our files are of the name "Backup(...)"
partial_file_name = "Backup"

#Suppose that MED-PC recorded the response and reinforcement counts in an array named "C" and response counts are recorded in index 0 of "C" and reinforcement counts were recorded in index 1.
c_name = list( resp = 0, rft = 1)
variable_arrays = list( C = c_name )

#Suppose that MED-PC recorded the events in an array named "X" and responses are marked with 100000, reinforcement marked with 200000, start marked with 900000
x_constants = list( resp = 1, rft = 2, start = 9 )
event_arrays = list( X = x_constants )

#Suppose that MED-PC recorded the arranged variable-intervals for reinforcement delivery in an array "J" and we wish to have it named "arranged_vi" in our "UOA_analysis_object".
general_arrays = list( J = "arranged_vi" )

#All together
import_medpc_to_UOA( partial_file_name, variable_arrays, event_arrays, general_arrays, file_path )

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