Summing Values โ€‹โ€‹in dplyr - RStudio Fails

Can dplyrchaining summariseon data.frame?

My data.frame has a structure:

data_df = tbl_df(data)    
data_df %.%
        group_by(col_1) %.%
        summarise(number_of= length(col_2)) %.%
        summarise(sum_of = sum(col_3)) 

This causes RStudio to encounter a message fatal error - R Session Aborted

Normally with plyrI would enable these features summarisewithout a problem.

UPDATE

The data is here.

The code:

library(dplyr)

orth <- read.csv('orth0106.csv')
orth_df = tbl_df(orth)


orth_df %.%
    group_by(Hospital) %.%
    summarise(Procs = length(Procedure)) %.%
    summarise(SSIs = sum(SSI))
+3
source share
1 answer

I can reproduce the error on a computer running Windows 7 RStudio 0.97.551

Perhaps this is because you invoke summariseand attach to something that does not exist. You can summarisewith two different columns, as I did here.

url <- "https://raw.github.com/johnmarquess/some.data/master/orth0106.csv"

library(dplyr)

orth <- read.csv(url)
orth_df <- tbl_df(orth)


orth_df %.%
    group_by(Hospital) %.%
    summarise(Procs = length(Procedure), SSIs = sum(SSI))

## Source: local data frame [18 x 3]
## 
##    Hospital Procs SSIs
## 1         A   865   80
## 2         B  1069   38
## 3         C   796   24
## 4         D   891   35
## 5         E   997   39
## 6         F   550   30
## 7         G  2598  128
## 8         H   373   27
## 9         I  1079   70
## 10        J   714   30
## 11        K   477   30
## 12        L   227    2
## 13        M   125    6
## 14        N   589   38
## 15        O   292    3
## 16        P   149    9
## 17        Q  1984   52
## 18        R   351   13

RStudio dplyr. , , , . https://github.com/hadley/dplyr/issues

( ) , rgui () :

R version 3.0.2 (2013-09-25)
Platform: i386-w64-mingw32/i386 (32-bit)

dplyr, .

, :

orth_df %.%
    group_by(Hospital) %.%
    summarise(Procs = length(Procedure))

Source: local data frame [18 x 2]

   Hospital Procs
1         A   865
2         B  1069
3         C   796
4         D   891
5         E   997
6         F   550
7         G  2598
8         H   373
9         I  1079
10        J   714
11        K   477
12        L   227
13        M   125
14        N   589
15        O   292
16        P   149
17        Q  1984
18        R   351

%.% summarise(SSIs = sum(SSI)) SSI?

, , , . %.% , ggplot2, . ggplot2 . %.%, , :

enter image description here

, :

   Hospital Procs
1         A   865
2         B  1069
3         C   796
.
.
.
17        Q  1984
18        R   351

%.% summarise(SSIs = sum(SSI)), SSI . , , , . %.% = serial ggplot() + = parallel. , R- , , .

+10

All Articles