我需要像这样转换一些数据:
df<-data.frame(Plate=c("4660", "4660", "4660", "4660", "4660", "4660", "4660", "4660", "4660", "4660", "4660"), Well=c("A1", "A2", "A3", "A4", "B1", "B2", "B3", "C1", "C2", "C3", "C4"), Result=c(1, 10, 100, 1000, 1, 10, 100, 1, 10, 100, 1000), Compound=c("C1", "C1", "C1", "C1", "C2", "C2", "C2", "C3", "C3", "C3", "C3"))
cmpds <- ddply(df, .(Compound), .fun = "t")
我想要结束的是:
1 2 3 4
A 1 10 100 1000
B 1 10 100 NA
C 1 10 100 1000
有没有办法用或忽略它来填充缺失的B4
行?NA
该t
功能或ddply
似乎因B
长度与其他长度不同而令人窒息。
谢谢,J--