Package 'medparser'

Title: MedPC Text Parser
Description: Parses information from text files with specific utility aimed at pulling information from Med Associate's (MPC) files. These functions allow for further analysis of MPC files.
Authors: Olivia Ortelli, Tony Colarusso
Maintainer: Olivia Ortelli <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2025-02-16 03:29:25 UTC
Source: https://github.com/cran/medparser

Help Index


DecimalStringToInteger

Description

Converts string into integer

Usage

DecimalStringToInteger(string)

Arguments

string

Character to be converted into an integer

Value

integer

An integer

Author(s)

Olivia Ortelli, Tony Colarusso

Examples

file_path <- system.file("extdata", "ExampleMPCOutput.txt", package = "medparser")
allText = readLines(file_path)
B_index = 1+grep("B:", allText[-1], value = FALSE)
Left_LeverPressBout = DecimalStringToInteger(PullStringFromIndex(allText,B_index+1))

PullStringFromIndex

Description

Pulls indices from MPC arrays

Usage

PullStringFromIndex(allText, index)

Arguments

allText

Character string containing MPC file

index

A number specifying the index where the array or value of interest begins in the MPC file

Value

stringValue

A character string following the index start

Author(s)

Olivia Ortelli, Tony Colarusso

Examples

file_path <- system.file("extdata", "ExampleMPCOutput.txt", package = "medparser")
allText = readLines(file_path)
B_index = 1+grep("B:", allText[-1], value = FALSE)
Left_LeverPressBout = DecimalStringToInteger(PullStringFromIndex(allText,B_index+1))

PullStringFromTextSearch

Description

Pulls string following specified text

Usage

PullStringFromTextSearch(allText, text)

Arguments

allText

Character string containing MPC file

text

A character string where matches are searched for

Value

stringValue

A character string where matches are searched for

Author(s)

Olivia Ortelli, Tony Colarusso

Examples

file_path <- system.file("extdata", "ExampleMPCOutput.txt", package = "medparser")
allText = readLines(file_path)
SubjectID = PullStringFromTextSearch(allText, "Subject:")

TimestampPull

Description

Pulls timestamps in H:M:S format

Usage

TimestampPull(allText, HMSindex)

Arguments

allText

Character string containing MPC file

HMSindex

A number specifying the index to pull from the H, M, and S arrays

Value

HMS

A single character combining the values from the H, M, and S arrays to read a complete time stamp (H:)

Author(s)

Olivia Ortelli, Tony Colarusso

Examples

file_path <- system.file("extdata", "ExampleMPCOutput.txt", package = "medparser")
allText = readLines(file_path)
C_index = 1+grep("C:", allText[-1], value = FALSE)
H_index = 1+grep("H:", allText[-1], value = FALSE)
M_index = 1+grep("M:", allText[-1], value = FALSE)
NumberOfTimestampsRecorded = (M_index-1)-(H_index+1)
firsttimestamp = TimestampPull(allText,1)