long2wide: Convert from the long format (single entry per row) to the...

Description Usage Arguments Details Value See Also Examples

Description

Takes a data frame of word pairs/triples/..., each stored in multiple rows, and returns a data frame with the same words but each pair/triple/... stored in one row. WARNING: in the original data frame, entries from all languages must be in the same order.

Usage

1
long2wide(data, col.lang = "LANGUAGE", skip = NULL)

Arguments

data

[data.frame] The dataset to be converted.

col.lang

[character] Name of the column with language names. Defaults to "LANGUAGE".

skip

[character vector] Names of columns to not convert. Defaults to NULL.

Details

Data for soundcorrs can be prepared in one of two formats: the 'long format' and the 'wide format'. In the 'long format', each row contains only a single word and metadata associated with it. In the 'wide format', each row contains the entire pair/triple/... of words, and all the metadata associated with them. The 'long format' is convenient for making sure that all the words in a pair/triple/... have the same number of segments, but it cannot be read directly by soundcorrs. long2wide and wide2long convert between the two formats.

Value

[data.frame] A data frame in the wide format (multiple entries per row).

See Also

wide2long

Examples

1
2
3
4
# path to sample data in the "long format"
fName <- system.file ("extdata", "data-abc.tsv", package="soundcorrs")
long <- read.table (fName, header=TRUE)
wide <- long2wide (long, skip=c("ID"))

soundcorrs documentation built on Nov. 16, 2020, 5:09 p.m.