Learn R Programming

soundcorrs (version 0.1.1)

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

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

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.

Value

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

Examples

Run this code
# NOT RUN {
# 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"))
# }

Run the code above in your browser using DataLab