我正在尝试使用融化功能重塑下表
structure(list(a = c(0.153705582462314, 0.0486852891805727, 0.0443466683559926,
0.049402643366726, 0.10496252040361, 0.0605314701268217, 0.123066826124396,
0.10436283816338, 0.123452539416624, 0.0921469079168177, 0.131665907599587,
0.0927555742098017, 0.228148961056112, 0.130543777324655, 0.0843670900309334,
0.131948120538527), b = c(0.158938848699283, 0.0487570327200071,
0.0454810210056237, 0.0510635787328623, 0.103120937885508, 0.0639093015144946,
0.111187181680815, 0.0978797635763352, 0.0792834772158317, 0.0582100024292881,
0.0860846940492594, 0.0620370376768188, 0.11814043806398, 0.0825043302248793,
0.0615953756935117, 0.0711048468042418), c = c(0.148449985263957,
0.0514334902734327, 0.0448107469650824, 0.0553431826494535, 0.11011576290828,
0.0596050964023732, 0.109924244560051, 0.100309207109092, 0.0772350806188979,
0.0567484442878015, 0.0943868769266179, 0.0642831549581465, 0.117850661875511,
0.0868600001807722, 0.0619469756159616, 0.0745909201443937),
d = c(0.153576142965318, 0.0440065816952808, 0.0383730598042165,
0.0466911489805908, 0.0883448739785253, 0.052233465825278,
0.0782617872165657, 0.0740854821951614, 0.0704324151657985,
0.051813360749928, 0.0865163379367009, 0.0581975106052581,
0.118039038983586, 0.082545661321027, 0.0567767394969306,
0.0641904998624335), e = c(0.161975563218496, 0.0457647898614343,
0.0394148591712433, 0.0454720734366032, 0.0822881130339494,
0.0520786880977144, 0.0772094145035842, 0.0685930881198674,
0.0634496037760497, 0.0475349902051384, 0.0730862457567602,
0.0539538999707352, 0.0918201356593523, 0.0711086911717703,
0.0541541288301524, 0.0575437259907984)), .Names = c("a",
"b", "c", "d", "e"), class = "data.frame", row.names = c("Naphthalene",
"Acenaphtylene", "Acenaphthene", "Fluorene", "Phenenthrene",
"Anthracene", "Fluoranthene", "Pyrene", "Benzo(a)anthracene",
"Chysene", "Benzo(b)fluoranthene", "Benzo(k)fluoranthene", "Benzo(a)pyrene",
"Indeno(1.2.3-cd)pyrene", "Dibenz(a.h)anthracene", "Benzo(g.h.i)perylene"
))
我想用 colnames (a,b,c,d,e,f) 创建组
我使用了融化功能
dfm <- melt(test,id=c("a","b","c","d","e"))
但是,生成的表与原始表相同。
有人可以指出我正确的方式吗?它应该很简单,但我已经尝试了几种组合但没有结果。