【问题标题】:I need help transforming one dataframe to another [closed]我需要帮助将一个数据框转换为另一个 [关闭]
【发布时间】:2017-11-28 12:17:26
【问题描述】:

我试图了解如何将图片1 中的数据框转换为2。我该如何进行转型?

【问题讨论】:

    标签: r


    【解决方案1】:

    我们可以使用gatherextract

    library(tidyverse)
    gather(df1, year, MatriculationRates, -1) %>%
          extract(year, into = 'year', '[^0-9]+([0-9]+)') 
    

    【讨论】:

      猜你喜欢
      • 2022-01-05
      • 2011-07-09
      • 1970-01-01
      • 2021-06-24
      • 2020-12-27
      • 2020-09-13
      • 1970-01-01
      • 2014-09-22
      • 1970-01-01
      相关资源
      最近更新 更多