Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 我需要帮助将一个数据帧转换为另一个数据帧_R - Fatal编程技术网

R 我需要帮助将一个数据帧转换为另一个数据帧

R 我需要帮助将一个数据帧转换为另一个数据帧,r,R,我试图理解如何将pic中的数据帧转换为。如何进行转换?我们可以使用收集和提取 library(tidyverse) gather(df1, year, MatriculationRates, -1) %>% extract(year, into = 'year', '[^0-9]+([0-9]+)')

我试图理解如何将pic中的数据帧转换为。如何进行转换?

我们可以使用
收集
提取

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