I have a data frame and want to change it from wide to long format but I have three variables, whereas ref = RR_ref, het = RR_het and hom = RR_hom.
df:
Number ref het RR_het hom RR_hom RR_ref
mary GG AG 0.29 AA 0.0841 1
wayne AA AG 1.7 GG 2.89 1
structure(list(Number = c("mary", "wayne"), ref = c("GG", "AA"
), het = c("AG", "AG"), RR_het = c(0.29, 1.7), hom = c("AA",
"GG"), RR_hom = c(0.0841, 2.89), RR_ref = c(1L, 1L)), .Names = c("Number",
"ref", "het", "RR_het", "hom", "RR_hom", "RR_ref"), class = "data.frame", row.names = c(NA, -2L))
desired output:
Name Vars Value
mary GG 1
wayne AA 1
mary AG 0.29
wayne AG 1.7
mary AA 0.0841
wayne GG 2.89
Anyone can help me? Thanks.