I am trying to convert my data frame from wide to long form based on a column's character string. In the example below, I want O2_222.coefficients.x1
and O2_217.coefficients.x1
in a single column, O2_222.R-squared
and O2_217.R-squared
in a single column and RunTime
as it's own. Attempted using melt
in the reshape2
package but can't seem to get the syntax right.
structure(list(O2_222.coefficients.x1 = c(0.494206524044508, 0.351865091962266,
0.348933739038027, 0.412232161883577, 0.702783684327072), `O2_222.R-squared` =
c(0.922054236839182, 0.915753625911676, 0.91109476704698, 0.917998834313392,
0.967759465780247), O2_217.coefficients.x1 = c(0.390012278483346, 0.0694948285748309,
0.0323121611694059, 0.0372526286990146, 0.194291648564898), `O2_217.R-squared` =
c(0.921256057864199, 0.537913087580067, 0.271398305115866, 0.274339042666519,
0.908338928665188), RunTime = c(9.03, 14.08, 19.08, 24.08, 29.08)), row.names = c(116L,
216L, 316L, 416L, 516L), class = "data.frame")