Learn R Programming

forestHES (version 2.0.1)

widetolong: A R function for converting to wide data to long data

Description

Converting wide data, such as species matrix, and attributes matrix to long data,such as the treedata and herbdata.

Usage

widetolong(widedata, leftlab = "left", uplab = "up", innerlab = "inner")

Value

Long data,such as treedata,herbdata, etc.

Arguments

widedata

Data similar to the species matrix, and attributes matrix, etc.

leftlab

Row labels of wide data

uplab

Column labels of wide data

innerlab

Attributes labels of inner data of wide data

Author

Zongzheng Chai

Examples

Run this code
herb.spematrix<-longtowide(longdata=herbdata,left="plot.id",up="spe.id",inner="abundance")
herb.spedata<-widetolong(herb.spematrix,
                              leftlab="plot.id",uplab="spe.id",innerlab="abundance")
herb.spedata
##After removed zero in innerdata
rd0herb.spedata<-herb.spedata[-which(herb.spedata$abundance==0),]
rd0herb.spedata

Run the code above in your browser using DataLab