Some text goes here. You can also put URL links like this one: http://rmarkdown.rstudio.com.
This is bold, this is italic. Is this italic bold?
Then you can embed code like this:
library(ggplot2)
set.seed(123) # Set seed for reproducible results
df <- data.frame(Year = 2000:2015,
Visitors = rnorm(16, mean = 1000000, sd = 50000))
You can also embed plots, for example:
ggplot(df, aes(x = factor(Year), y = Visitors)) +
geom_bar(stat = "identity", fill = "darkred") +
scale_x_discrete(name = "Year") +
scale_y_continuous(name = "Number of Visitors",
limits = c(0, 1200000),
breaks = seq(0, 1200000, 200000),
expand = c(0, 0),
label = scales::comma) + # Need to have package "scales"" installed
ggtitle("A Fictional Example\n") +
theme_minimal() +
theme(title = element_text(size = 14, face = "bold", hjust = 0),
axis.ticks.x = element_blank())
If we had used echo = FALSE
instead of echo = TRUE
above, the code generating the plot would not have been printed.
And here’s an attempt at using plotly
:
library(plotly)
##
## Attaching package: 'plotly'
##
## The following object is masked from 'package:ggplot2':
##
## last_plot
##
## The following object is masked from 'package:graphics':
##
## layout
plot_ly(df, x = factor(Year), y = Visitors, type = "bar") %>%
layout(title = "A Fictional Example",
xaxis = list(title = "Year"),
yaxis = list(title = "Number of Visitors"))