Assume I have the following short example. My goal is to rearrange the data.frame
by column "n"
, so that the output looks as shown below. Since I am still the beginner I don't know how to do this. I tried with reshape2
.
Method n lambda df
10.fold.CV Lasso 30 1.3102653 21.199
10.fold.CV.1SE 30 3.3734592 17.379
10.fold.CV Lasso 50 0.8956816 28.713
10.fold.CV.1SE 50 2.3527001 25.540
BIC 50 1.9833844 24.757
Modified.BIC 50 0.2091384 31.714
10.fold.CV Lasso 100 0.6467475 33.591
10.fold.CV.1SE 100 2.4961030 32.092
The expected output should look like this:
Lambda30 df30 Lambda50 df50 Lambda100 df100
10.fold.CV Lasso 1.3102653 21.199 0.8956816 28.713 0.6467475 33.591
10.fold.CV.1SE 2.3527001 25.540 3.3734592 17.379 2.4961030 32.092
BIC 1.9833844 24.757 ..
Modified.BIC 0.2091384 31.714 ..