Learn R Programming

soundcorrs (version 0.1.1)

scOne: Constructor function for the scOne class.

Description

Take a data frame containing data for one language, in the wide format, and combine it with metadata into a scOne object. In a normal workflow, the user should have no need to invoke this function other than through read.scOne.

Usage

scOne(data, name, col.aligned, transcription, separator = "\\|")

Arguments

data

[data.frame] Data for one language.

name

[character] Name of the language.

col.aligned

[character] Name of the column with the aligned words.

transcription

[transcription] The transcription for the given language.

separator

[character] String used to separate segments in col.aligned. Defaults to "\|".

Value

[scOne] A scOne object containing the data and metadata for one language.

Fields

cols

[character list] Names of important columns.

data

[data.frame] The original data.

name

[character] Name of the language.

segms

[character list] Words exploded into segments. With linguistic zeros preserved ($z) or removed ($nz).

segpos

[integer list] A lookup list to check which character belongs to which segment. Counted with linguistic zeros preserved ($z) and removed ($nz).

separator

[character] The string used as segment separator in col.aligned.

trans

[transcription] The transcription object for the language.

words

[character list] Words obtained by removing separators from the col.aligned column. With linguistic zeros ($z) or without them ($nz).

Examples

Run this code
# NOT RUN {
fNameData <- system.file ("extdata", "data-capitals.tsv", package="soundcorrs")
fNameTrans <- system.file ("extdata", "trans-common.tsv", package="soundcorrs")
readData <- read.table (fNameData, header=TRUE)
readTrans <- read.transcription (fNameTrans)
ger <- scOne (readData, "German", "ALIGNED.German", readTrans)
# }

Run the code above in your browser using DataLab