HertieDataScience / SyllabusAndLectures

Hertie School of Governance Introduction to Collaborative Social Science Data Analysis
MIT License
37 stars 60 forks source link

Excluding Dummy from Mean and SD Calculations Stargazer #84

Closed LisaKatharina closed 8 years ago

LisaKatharina commented 8 years ago

Dear all,

has anyone of you figured out how to get a stargazer summary table where there is no mean or sd calculated for dummy variables (as they are not meaningful)? Help would be much appreciated!

Best, Lisa

christophergandrud commented 8 years ago

My first would be to declare the variable as a factor.

LisaKatharina commented 8 years ago

Dear Christopher, thanks for this hint! I tried it but when I include the variable into the stargazer command, it just drops it instead of treating it like a dummy... This was what I used to transform the variable: Data$east_factor <- factor(ifelse(as.numeric(Data$east)==1, 1, 0))

christophergandrud commented 8 years ago

Maybe we should step back a bit: what goal are you trying to achieve? Is it a table with the variables in rows and descriptive stats (like mean, median, SD, etc) in columns? If so, I would put the nominal factor variables in a different table with frequencies of the categories.

LisaKatharina commented 8 years ago

That is exactly what I wanted to achieve: A summary table with variables in rows with descriptive stats. Alright, I will exclude the nominal variable from the table then and put it into a different one. Thanks for your help!!

christophergandrud commented 8 years ago

Sounds good.