How can I store this information in a dataset?

I am new to R and I have a doubt I need to store the table that generates me after group_by (Private)%>% summarize, to later graph it.
this is my code


install.packages("ISLR")

library(dplyr)
library(ISLR)
library(ggplot2)

College

data <- tbl_df(College)
data%>%
  group_by(Private)%>%
  summarise(sum_enroll = sum(Enroll, na.rm = TRUE),
            count = n(),
            averange_enroll = mean(Enroll, na.rm =  TRUE))

Thank you

Hi @Raptor,

In R if you want to keep some results around you just need to assign it to a variable:

some_name <-
data %>%
  group_by(Private)%>%
  summarise(sum_enroll = sum(Enroll, na.rm = TRUE),
            count = n(),
            averange_enroll = mean(Enroll, na.rm =  TRUE))

some_name
1 Like

Thank you @mattwarkentin !!! it worked for me!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.