【发布时间】:2020-05-19 18:32:26
【问题描述】:
我有一个如下所示的数据框:
my.col gathered
1 Country 2008_2019
2 Year 2008_2019
3 avgbw 2008_2019
4 avgmx 2008_2019
5 adspd 2008_2019
12 ecom_cb 2011_2019
13 ecom_mbl 2011_2019
14 iaccess 2008_2019
15 ibank 2012_2019
16 ibus 2008_2019
17 ictinv 2008_2019
18 iusage 2008_2019
19 laptop 2008_2019
20 mbl_access 2014_2019
21 midle 2008_2019
22 pcomp 2008_2019
23 phone 2008_2019
24 rtlpc 2008_2019
25 smart 2008_2019
26 tpc 2008_2019
27 ibuy_class 2014_2017
28 rdply_class 2014_2017
29 mdply_class 2014_2017
30 acnt_class 2011_2017
31 ibuy_gen 2014_2017
32 rdply_gen 2014_2017
33 mdply_gen 2014_2017
34 acnt_gen 2011_2017
35 ibuy_rural 2014_2017
36 rdply_rural 2014_2017
37 mdply_rural 2014_2017
38 acnt_rural 2011_2017
我正在寻找一个脚本,它返回带有 gathered 中每个唯一值的所有 my.col 值的向量(由 gathered 值命名)
示例输出:
`2014_2017` <- c("ibuy_class", "rdply_class", ... , "mdply_rural")
`2011_2017` <- c("acnt_class", "acnt_gen", "acnt_rural")
谢谢
【问题讨论】: