HertieDataScience / SyllabusAndLectures

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

messed up output #114

Open MarieAgosta opened 7 years ago

MarieAgosta commented 7 years ago

With this line of code:



library(dplyr)
library(stargazer)
age <- anes$dem_age_r_x %>% as.data.frame()
#stargazer(age, type = "text", summary = TRUE) for seeing #what the table looks #like, because without specifying text it just looks like the code for output as #it will eventually appear in a knitted document stargazer
(age, summary = TRUE)
stargazer(age, summary = TRUE)

We get this output before our table. I have been googling away as to why and how to correct it but I just don’t understand. Could you please help me? 

![screen shot 2016-11-11 at 10 09 49 am](https://cloud.githubusercontent.com/assets/22035414/20211540/568ac1be-a7ff-11e6-9f36-9ad4cf42754f.png)
tori-d commented 7 years ago

Hey Marie -- so you want to get rid of the "attaching package" and "please cite as" messages?

In your r code chunk in your markdown document, try adding these messages:

```{r, message=F, warning=F, results ='asis'}

Message = F and Warning = F should suppress these types of messages from showing. Reults='asis' helps ensure the table is formatted correctly by Knittr. Does this help?

MarieAgosta commented 7 years ago

Thanks Tori! I appreciate the help. One more if you happen to know… how to stop a table from running off the page when using stargazer? It’s a pretty basic frequency table…

Thanks again,

Marie

From: Tori notifications@github.com<mailto:notifications@github.com> Reply-To: HertieDataScience/SyllabusAndLectures reply@reply.github.com<mailto:reply@reply.github.com> Date: Friday, November 11, 2016 at 11:23 AM To: HertieDataScience/SyllabusAndLectures SyllabusAndLectures@noreply.github.com<mailto:SyllabusAndLectures@noreply.github.com> Cc: Marie M.Agosta@lse.ac.uk<mailto:M.Agosta@lse.ac.uk>, Author author@noreply.github.com<mailto:author@noreply.github.com> Subject: Re: [HertieDataScience/SyllabusAndLectures] messed up output (#114)

Hey Marie -- so you want to get rid of the "attaching package" and "please cite as" messages?

In your r code chunk in your markdown document, try adding these messages:


Message = F and Warning = F should suppress these types of messages from showing. Reults='asis' helps ensure the table is formatted correctly by Knittr. Does this help?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://github.com/HertieDataScience/SyllabusAndLectures/issues/114#issuecomment-259927396>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AVA71q-Z17fTfYafstZuazO37T3ST9tXks5q9EIUgaJpZM4Kvmqi>.
christophergandrud commented 7 years ago

A suggestion on the frequency table issue. One easy option is to choose a smaller font size (in stargazer you can choose font.size = 'tiny' for example.

Generally though, if the are running onto multiple pages with a frequency table it is better to think of a more effective way to visualise the data, e.g. a histogram or other chart.