r - dplyr to output class data.frame -


i can summarise data frame dplyr this:

mtcars %.% group_by(cyl) %.% summarise(mean(mpg)) 

to convert output class data.frame, current approach this:

as.data.frame(mtcars %.% group_by(cyl) %.% summarise(mean(mpg))) 

is there way dplyr output class data.frame without having use as.data.frame?

as pointed out in comments might not need convert since might enough inherits data frame. if not enough still uses as.data.frame more elegant:

mtcars %>%    group_by(cyl) %>%    summarise(mean(mpg)) %>%    as.data.frame() 

added read in comments reason want avoid truncation of printed output. in case define option, possibly in .rprofile file:

options(dplyr.print_max = inf) 

(note can still hit maximum defined "max.print" option associated print need set 1 if low you.)

update: changed %.% %>% reflect changes in dplyr.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -