我有一個數據幀,如下所示:ř如何將一個數據幀劃分成單列
days target probability
1 75 0.80 0.9060341
2 100 0.90 0.75
df <- structure(list(days = c(75, 100, 120, 150, 200, 300, 75, 100,
120, 150, 200, 300, 75, 100, 120, 150, 200, 300, 75, 100, 120,
150, 200, 300, 75, 100, 120, 150, 200, 300, 75, 100, 120, 150,
200, 300), target = c(0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.9, 0.9,
0.9, 0.9, 0.9, 0.9, 1, 1, 1, 1, 1, 1, 1.05, 1.05, 1.05, 1.05,
1.05, 1.05, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.2, 1.2, 1.2, 1.2,
1.2, 1.2), probability = c(0.90603410539241, 0.90603410539241,
0.90603410539241, 0.90603410539241, 0.90603410539241, 0.904213051602258,
0.733995206180212, 0.733995206180212, 0.733995206180212, 0.733995206180212,
0.733995206180212, 0.731795453278156, 0.512082243536284, 0.512082243536284,
0.512082243536284, 0.512082243536284, 0.512082243536284, 0.511492313399902,
0.390943562448882, 0.390943562448882, 0.390943562448882, 0.390943562448882,
0.390943562448882, 0.391451116324459, 0.282452594645645, 0.282452594645645,
0.282452594645645, 0.282452594645645, 0.282452594645645, 0.283766337160544,
0.106271449405461, 0.106271449405461, 0.106271449405461, 0.106271449405461,
0.106271449405461, 0.107778317673786)), .Names = c("days", "target",
"probability"), class = "data.frame", row.names = c(1L, 2L, 3L,
4L, 5L, 7L, 9L, 10L, 11L, 12L, 13L, 15L, 17L, 18L, 19L, 20L,
21L, 23L, 25L, 26L, 27L, 28L, 29L, 31L, 33L, 34L, 35L, 36L, 37L,
40L, 43L, 44L, 45L, 46L, 47L, 49L))
,並希望有一個單一的行中的一個CSV emmited與以下幾部件標頭文件:
day75_target0.80,day100_target0.9等等 - 每行中的值應該只是相應的概率。
想法?
請從'dput'中取出'+'s –