mpc_backup_reader: Import data from Med-PC to 'formal_event_record's

Description Usage Arguments Details Examples

View source: R/import_medpc_to_formal_event_record.R

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
mpc_backup_reader(datatable, file_match, variable_arrays, event_arrays,
  general_arrays, rounding, row)

Arguments

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.

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.

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.

Examples

1
2
3
4
5
6
variable_arrays = list( C = c("resp","rft") )
event_arrays = list( X = c("resp_time" = 1, "rft_time" = 2, "start" = 9 ) )
general_arrays = list( J = "arranged_vi" )
file_path = "F:/Dropbox/Don/model_data"

data = import_medpc_to_formal_event_record( "Backup", variable_arrays, event_arrays, general_arrays, file_path = "F:\\Dropbox\\Don\\model_data", rounding = 2)

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