gpt4 book ai didi

r - 如何翻转 R 中的行和列

转载 作者:行者123 更新时间:2023-12-04 05:17:24 25 4
gpt4 key购买 nike

我目前有:

Country.Name   1995 1996 1997 ... 2013
Country1
Country2 (numeric data)
Country3

- 这种格式使每个国家的数据难以绘制图表并进行比较,因为标题列是单独的年份

我想要:
Year  Country1   Country2   Country3
1995
1996
1997 (numeric data)
...
2013

最佳答案

df_transpose = t(df_original)

查看更多: http://www.r-statistics.com/tag/transpose/

关于r - 如何翻转 R 中的行和列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33643181/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com