Learn R Programming

soundcorrs (version 0.2.0)

soundcorrs: Constructor function for the soundcorrs class.

Description

Take a data frame and turn it into a soundcorrs object containing data for one language. To obtain a soundcorrs object containing data for multiple languages, see merge.soundcorrs. In the normal workflow, the user should have no need to call this constructor other than through read.soundcorrs.

Usage

soundcorrs(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

[soundcorrs] An object containing the data and metadata for one language.

Fields

cols

[character list] Names of important columns.

data

[data.frame] The original data.

names

[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).

separators

[character] The strings used as segment separator in cols$aligned.

trans

[transcription] The transcription.

words

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

Examples

Run this code
# NOT RUN {
# read sample data in the "wide format"
fNameData <- system.file ("extdata", "data-capitals.tsv", package="soundcorrs")
readData <- read.table (fNameData, header=TRUE)
# read the sample transcription
fNameTrans <- system.file ("extdata", "trans-common.tsv", package="soundcorrs")
readTrans <- read.transcription (fNameTrans)
# make out of them a soundcorrs object
ger <- soundcorrs (readData, "German", "ALIGNED.German", readTrans)
pol <- soundcorrs (readData, "Polish", "ALIGNED.Polish", readTrans)
spa <- soundcorrs (readData, "Spanish", "ALIGNED.Spanish", readTrans)
dataset <- merge (ger, pol, spa)
# }

Run the code above in your browser using DataLab