I am trying to unmelt a big table with variables. this thread did only give me hints but did not solve my problem (How to "unmelt" data with reshape r).
I am trying to get from here:
name1 name2 values group
xyz1 abc1 1 group1
xyz2 ghf 2 group2
xyz3 lmn 3 group1
xyz4 opq 4 group2
xyz1 abc1 5 group2
xyz2 ghf 6 group1
xyz3 lmn 7 group2
xyz4 opq 8 group1
xyz5 stu 2 group3
to
name1 name2 group_1 gruoup_2 group_3
xyz1 abc1 1 6 NA
xyz2 ghf33 6 2 NA
xyz3 lmn93 3 5 NA
xyz4 opq42 8 4 NA
xyz5 stu21 NA NA 2
my current commands to "unmelt" are
d <- read.table("test.txt", header=T, sep="\t")
e <- dcast(d, name1 + name2 ~ group ~ values)
but this does not assign the values to the groups and name1 and name2 Would be great if you could help me out. Thank you so much! D