inst/snippet/traffic-reshape.R

traffic

reshape(traffic[,-2], idvar="year",ids=row.names(traffic),
        times=names(traffic)[3:6],timevar="state",
        varying=list(names(traffic)[3:6]),
        v.names="deathRate",
        direction="long") -> longTraffic
head(longTraffic)

Try the fastR package in your browser

Any scripts or data that you put into this service are public.

fastR documentation built on May 2, 2019, 5:53 p.m.