Skip to content

Instantly share code, notes, and snippets.

@paulina-grunwald
Created January 5, 2017 20:34
Show Gist options
  • Save paulina-grunwald/8aa2cadd1bf1add930a5304be0fa8481 to your computer and use it in GitHub Desktop.
Save paulina-grunwald/8aa2cadd1bf1add930a5304be0fa8481 to your computer and use it in GitHub Desktop.
Creating summary statistics using stargazer package
#Load necessary packages
library(stargazer)
library(readr)
#Load cvs file from url
df_ww <- read.csv("https://raw.githubusercontent.com/paulina-grunwald/R-HackRoom/master/Creating%20summary%20statistics%20using%20stargazer%20package/wineQualityWhites.csv")
#Create summary statistics using stargazer package
df_stat <- data.frame(df_ww)
#Drop columns X and quality
df_stat[,c("X", "quality")]<- list(NULL)
#Assign column names from df_stat data frame to columns variable
columns <- colnames(df_stat)
#Create summary statistics table using stargazer package
t1 <- stargazer(
df_stat[,columns], type = "text",
summary.stat = c("min", "p25", "median", "p75", "max", "median", "sd")
)
t1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment