DS4PS / ddmp-uw-class-spring-2019

Data-Driven Management & Policy Course at UW, Spring 2019
https://ds4ps.github.io/ddmp-uw-class-spring-2019/
4 stars 3 forks source link

Output not showing up in Markdown #8

Closed taylynners04 closed 5 years ago

taylynners04 commented 5 years ago

Hi there,

I can't seem to get any output (plots, tables, etc.) to show up in the HTML Markdown when I knit my code. Here's an example of my code. Do you know why it would not be showing the output in the Markdown file?


Part 2: Bar Charts

install.packages("ggplot2")
library(ggplot2)
frTable=as.data.frame(table(hsb$RACE))
names(frTable)=c('Type','Count')
baseNom= ggplot(data = frTable, 
             aes(x=Type, y=Count)) 
install.packages("expss")
library(expss)
val_lab(hsb$RACE) = num_lab("
                            1 Hispanic
                            2 Asian
                            3 Black
                            4 White
")
head(hsb$RACE)
titletext='Racial Breakdown of High School Students'
sourcetext='Source: National Opinion Research Center (1980)'

barNom=baseNom + geom_bar(stat = 'identity') + labs(title = titletext,
                                                    caption = sourcetext)
barNom

I am using {r, eval=FALSE} in each code chunk. I thought the issue might have to do with the "eval=FALSE" rule, but I removed it and changed it multiple times and still did not get any output when I would knit the code.

Thanks, Taylor Bailey

taylynners04 commented 5 years ago

I figured it out. I did need to remove eval=FALSE from some of the code chunks, but keep it when a code chunk included install.packages().