Ggplot error - cannot knit into html

ggplot2
html
knit

#1

I am using a Mac to plot age vs. survival data. The plot creates but now I cannot knit into an html file due to a "Removed 177 rows containing non-finite values (stat_bin)" error. I tried changing to geom_bar and also changed scale_x_discrete but the error below shows:

Error in ggplot(data = titanic, aes(x = Age)) :
could not find function "ggplot" Calls: . . . handle -> withCallingHandlers -> withVisibl -> eval -> eval Execution halted

Here is my original equation:

ggplot(data = titanic , aes(x = Age)) +
geom_histogram(binwidth = 1, color = 'blue', fill = '#00FFFF') +
scale_x_continuous(limits = c(0, 85), breaks = seq(0, 85, 20)) +
xlab('Age of passengers') +
ylab('Number of passengers') +
facet_wrap(~Survived)


#2

Hi @lia22

Could you tell me where you got the titanic dataset. I am not able to duplicate the error

Best guess; based on the error message you may have to call the library for ggplot assuming its installed already. Place it before your code and hopefully it will work within the chunk

library(ggplot2) 

# Your code here....




#3

I got it from Kaggle. It worked!! Thanks so much @john.smith!