Home > Enterprise >  RMarkdown knitting produces each plot twice
RMarkdown knitting produces each plot twice

Time:04-20

This is the code:

---
title: "Data Analysis"
author: "Author"
date: "`r Sys.Date()`"
output: word_document
---

{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

library(viridisLite)
library(ggplot2)
library(GGally)
library(plotly)
library(readxl)
library(vtable)
library(imputeTS)
library(janitor)
library(tibble)
library(readr)
library(survival)
library(survminer)
library(tidyr)
library(tidyverse)
library(broom)
library(DataExplorer)
library(dplyr)
library(WeibullR)
library(ggfortify)
library(factoextra)
library(gridExtra)
```

Text Text Text

{r unsorted, echo=FALSE, warning=FALSE}
setwd("C:/Users/R//")
df = data.frame(read.csv("file.csv"
                         , header = TRUE
                         , sep = ";"
                         , dec = ","
                         , na.strings = "---"))

# clean data frame ----
df<- df %>%
  clean_names()
df<- df %>% janitor::remove_empty(whic=c("rows"))
df<- df %>% janitor::remove_empty(whic=c("cols"))
df<- dplyr::distinct(df)
colnames(df)[1]<- "country"
df_unsorted<- df

DataExplorer::plot_missing(df_unsorted[, 1:ncol(df_unsorted)]
            , theme_config =list(axis.text=element_text(size = 12)))   theme_bw()

```

which, whyever, results in:

img

weird enough, that the plots look slightly different but I don't see any reasons why they are plotted, respectively why one of them. I've also seen enter image description here

  • Related