Learn R Programming

dataprep (version 0.1.5)

melt: 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.

Value

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

Details

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

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

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

Run the code above in your browser using DataLab