0
我有一个非常大的表,它与下面描述的有点类似。使用R转换多个列值的数据
RF1 <- structure(list(FullCloneName = structure(c(1L, 1L, 1L, 1L, 1L,
1L, 2L, 2L, 2L, 2L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 6L, 7L, 8L, 9L,
10L, 11L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 13L), .Label = c("010.4279.5G6", "010.X105732.87-272-7B6.B10",
"1068.Z32346.20H4.9.8", "1100.2868.6A1.E2", "1100.2990.16E9.H6",
"1100.3113.11A6.F1", "1100.3114.16H1.F11", "1100.3115.14F11.H4",
"1100.3115.19A9.F10", "1100.3117.2F7.B11", "1100.Z78346.13E8.C10",
"1100.Z78346.18G2.F3.G4", "1100.Z78347.18C6.B11"), class = "factor"),
Domain = structure(c(2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L,
1L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L
), .Label = c("VH", "VK"), class = "factor"), FieldName = structure(c(5L,
6L, 1L, 2L, 3L, 4L, 5L, 6L, 1L, 3L, 5L, 1L, 5L, 6L, 1L, 3L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 5L, 6L, 5L, 6L,
1L, 1L, 3L, 1L, 3L, 1L, 3L, 5L), .Label = c("HeavyChainObservedMass1",
"HeavyChainObservedMass2", "HeavyChainRelativeAbundance1",
"HeavyChainRelativeAbundance2", "LightChainObservedMass1",
"LightChainRelativeAbundance1"), class = "factor"), ResultValue = c(23838L,
100L, 49057L, 49185L, 82L, 18L, 24219L, 100L, 49191L, 100L,
23787L, 50108L, 24218L, 100L, 49421L, 100L, 24349L, 24131L,
23911L, 24197L, 24247L, 24345L, 23925L, 23675L, 23676L, 23675L,
100L, 23675L, 100L, 23675L, 100L, 49828L, 49829L, 100L, 49830L,
100L, 49830L, 100L, 23850L)), .Names = c("FullCloneName",
"Domain", "FieldName", "ResultValue"), class = "data.frame", row.names = c(NA,
-39L))
library(reshape2)
pivotRF1 <- dcast(RF1, FullCloneName + Domain ~ FieldName)
我试图摆动数据,但是,不能。请指教!
'dcast(RF,FCN +测试〜FN)'? – rawr
随着tidyr,'RF%>%的价差(FN,ResultValue)' – alistaire
Hi @rawr,您的解决方案的示例数据就像魅力一样。但是当我实时使用相同类型的数据时,我仍然面临这个问题。有什么办法可以与您分享部分实时数据以检查您的结局吗? – RanonKahn