melt {dataprep}R Documentation

Turn variable names and values into two columns

Description

Turn the names and values of all pending variables into two columns. These variables are inversely selected inside function (cols) and waiting to be melted. After melting, the data format changes from wide to long.

Usage

melt(data, cols = NULL)

Arguments

data

A data frame to melt, from the column start to the column end.

cols

Inversely selected columns inside function, except which are columns waiting to be melted.

Details

This function (dataprep::melt) will be used when reshape2 is not installed.

Value

A long-format data frame from its original wide format.

Author(s)

Chun-Sheng Liang <liangchunsheng@lzu.edu.cn>

References

1. Example data is from https://smear.avaa.csc.fi/download. It includes particle number concentrations in SMEAR I Varrio forest.

2. Wickham, H. 2007. Reshaping data with the reshape package. Journal of Statistical Software, 21(12):1-20.

Examples

# The first pending variable contains only NA
melt(data,1:4)

# Number concentrations of modes and total particles are not NA
melt(data1,1:2)

[Package dataprep version 0.1.5 Index]