Using reshape2::melt()
:
# read data
curve.wide <- read.table(sep=" ", header=T, text="1M 3M 6M 1Y 2Y 3Y 5Y 7Y 10Y 20Y 30Y
2014-01-17 0.01 0.05 0.07 0.11 0.40 0.79 1.64 2.27 2.84 3.50 3.75
2014-01-21 0.01 0.04 0.07 0.12 0.40 0.81 1.67 2.29 2.85 3.50 3.74
2014-01-22 0.00 0.04 0.07 0.11 0.44 0.85 1.72 2.34 2.87 3.52 3.75
2014-01-23 0.01 0.04 0.05 0.11 0.39 0.77 1.62 2.24 2.79 3.44 3.68")
curve.wide$Date <- row.names(curve.wide)
# wide to long
require(reshape2)
curve.long <- melt(data=curve.wide,
id.vars="Date",
variable.name="Maturities",
value.name="Rates")