这是我的数据:
structure(list(gender = c("Female", "Female", "Female", "Female",
"Female", "Female", "Male", "Male", "Male", "Male", "Male", "Male"
), bins = c("1", "2", "3", "4", "5", "6", "1", "2", "3", "4",
"5", "6"), cases = c(1L, 23L, 28L, 28L, 2L, 1L, 2L, 119L, 77L,
79L, 24L, 0L), employees = c(1L, 15L, 12L, 11L, 2L, 1L, 2L, 48L,
45L, 38L, 16L, 0L), headcount = c(7L, 180L, 145L, 117L, 38L,
1L, 37L, 797L, 1167L, 945L, 785L, 61L), propC = c(14.2857142857143,
12.7777777777778, 19.3103448275862, 23.9316239316239, 5.26315789473684,
100, 5.40540540540541, 14.930991217064, 6.5981148243359, 8.35978835978836,
3.05732484076433, 0), propE = c(14.2857142857143, 8.33333333333333,
8.27586206896552, 9.4017094017094, 5.26315789473684, 100, 5.40540540540541,
6.02258469259724, 3.8560411311054, 4.02116402116402, 2.03821656050955,
0)), row.names = c(NA, -12L), class = "data.frame")
我想知道如何将包含“男性/女性”的所有行向右移动,以便第一行看起来像这样:
Female 1 1 1 7 14.285714 14.28571 Male 1 2 2 37 5.405405 5.40540