如何在R中组合列

时间:2017-08-09 16:03:12

标签: r

http://imgur.com/a/q4IdW" table"

嗨,我有一个编码投诉的文件,你可以在上面的链接中看到它,我需要找到一种方法来组合4列(主要问题,次要问题等),这样我就可以总结一起解决所有问题。投诉可能存在多个问题,因此这就是为什么它会像这样分解,但出于分析目的,我希望将所有问题列视为相同。我是R的新手,所以请尝试用能够理解的语言说话,或者能够很快地谷歌

> str(mydata)
'data.frame':   136 obs. of  25 variables:
 $ ï..Issue.ID                  : Factor w/ 136 levels "CAO-2017-01",..: 20 21 22 23 24 25 26 27 28 29 ...
 $ Reviewer.ID                  : Factor w/ 1 level "Vinokurov, A": 1 1 1 1 1 1 1 1 1 1 ...
 $ Review.Date                  : Factor w/ 3 levels "6/30/2017","7/14/2017",..: 1 1 1 1 1 2 2 2 2 2 ...
 $ CBA.ZIP.CODE                 : Factor w/ 61 levels "Allentown-Bethlehem-Easton, PA",..: 29 13 24 10 29 13 10 9 47 39 ...
 $ Source.of.complaint          : Factor w/ 7 levels "Advocate","Beneficiary",..: 7 7 3 7 6 7 2 3 3 3 ...
 $ Primary.Issue.Category       : Factor w/ 10 levels "Billing, coverage, coordination of benefits",..: 3 8 4 4 4 4 7 4 4 4 ...
 $ Secondary.Issue.Category     : Factor w/ 15 levels "","ABN issues ",..: 4 1 15 1 15 3 3 15 15 15 ...
 $ Third.Issue.Category         : Factor w/ 12 levels "","- Error -",..: 1 1 1 1 1 5 1 10 1 1 ...
 $ Fourth.Issue.Category        : Factor w/ 2 levels "","Low quantity/quality": 1 1 1 1 1 1 1 1 1 1 ...
 $ Reviewer.Issue.Notes         : logi  NA NA NA NA NA NA ...
 $ Primary.Equipment.Category   : Factor w/ 13 levels "Commode chairs",..: 9 7 2 8 2 9 10 10 2 2 ...
 $ Secondary.Equipment.Category : Factor w/ 7 levels "","- Error -",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ Third.Equipment.Category     : Factor w/ 10 levels "","- Error -",..: 1 1 1 1 1 2 1 2 1 1 ...
 $ Fourth.Equipment.Category    : logi  NA NA NA NA NA NA ...
 $ Reviewer.Equipment.Notes     : logi  NA NA NA NA NA NA ...
 $ Primary.Resolution.Category  : Factor w/ 16 levels "Beneficiary educated about DMEPOS\n",..: 9 12 15 12 5 14 13 9 5 10 ...
 $ Secondary.Resolution.Category: Factor w/ 18 levels "","- Error -",..: 1 1 3 1 4 7 7 17 15 1 ...
 $ Third.Resolution.Category    : Factor w/ 8 levels "","Beneficiary educated about inquiry ",..: 1 1 1 1 3 1 1 1 1 1 ...
 $ Fourth.Resolution.Category   : logi  NA NA NA NA NA NA ...
 $ Reviewer.Resolution.Notes    : logi  NA NA NA NA NA NA ...
 $ Future.Action                : Factor w/ 4 levels "no","No","yes",..: 4 4 2 2 2 2 3 4 1 1 ...
 $ Coder.1                      : Factor w/ 2 levels "Briskin-Limehouse, A",..: 1 1 1 1 1 2 2 2 2 2 ...
 $ Coder.1.Coded.Date           : Factor w/ 4 levels "6/30/2017","7/13/2017",..: 1 1 1 1 1 2 2 2 2 2 ...
 $ Coder.2                      : Factor w/ 1 level "Aliu, F": 1 1 1 1 1 1 1 1 1 1 ...
 $ Coder.2.Coded.Date           : Factor w/ 7 levels "6/30/2017","7/12/2017",..: 1 1 1 1 1 2 3 3 3 3 ...
> 

1 个答案:

答案 0 :(得分:0)

我得到的是:你有这样的事情:

        issue_1 issue_2 issue_3 issue_4
person1    0       0       0       1
person2    1       1       0       1
person3    1       0       1       1

其中1表示存在问题,而0则相反,从某些调查中得出。

你想展示这样的东西吗?

Issue_1 appeared 2x 
issue_2 appeared 1x
issue_4 appeared 3x

你能再次检查并回答吗?

请使用str(your_data),因为您无法链接我们