Hi everyone,
first up, it is my first coding assignment and I am already desperate. I downloaded the latest version of Rstudio for Mac 3 days ago and I am now trying to submit an assignment in word format that displays graphs about life expectancies. When I run the code in Rstudio, the plot is shown correctly. However, once I knitr it to html or other formats, it only shows the code, not the graphs. Below, you can see what I did.
---
title: "assignment"
author: "mimler"
date: "23.07.2019"
output:
html_document:
highlight: zenburn
theme: flatly
toc: yes
toc_float: yes
pdf_document:
toc: yes
word_document:
toc: yes
---
```{r load-libraries, warning=FALSE, message=FALSE, echo=FALSE}
library(tidyverse) # Load ggplot2, dplyr, and all the other tidyverse packages
library(gapminder) # gapminder dataset
library(dplyr)
library(ggplot2)
```
```{r}
country_data <- gapminder %>%
filter(country == "Germany") # I come from Germany.
continent_data <- gapminder %>%
filter(continent == "Europe")
```
```{r, lifeExp_one_country}
plot1 <- ggplot(country_data,aes(x = year, y = lifeExp))+
geom_point() +
geom_smooth(se = FALSE) +
print(plot1)
```
This is just copied out of my Rstudio session. Most of it was already given and I just had to put in the aesthetics etc. I tried to find an answer online, and sometimes I thought I found the correct thread, but then technical terms made it impossible for me to understand, as I started R just 3 days ago. So, I would be very greatful for an easy explanation. If you require any further information, I will try to provide it.
Thanks.