Why i receive an error from R while i knit it to pdf

---
title: 'Homework 2 for Metra Potential Method '
author: "Nikos Matsavelas"
date: "3/26/2020"
output:
  pdf_document: default
  word_document: default
  bibliography: bibliography.bib
  html_document: default
---
## Operational Research Homework 
This homework is from Dr.Ioannis Coletsos exercises assignment in NTUA MSc in Applied Mathematical Sciences (Flow C:Probability & Statistics) 


## Load the needed Packages

```{r}

library(igraph)
library(ProjectManagement)
library(projmanr)
```



##  Precedence Design Matrix

There are four types of precedence between two activities $i,j$: 
Type 1:(Finish-Start) the activity $j$ cannot start until activity $i$ has finished. 
Type 2:(Start-Start) the activity $j$ cannot start until activity $i$ has started. 
Type 3:(Finish-Finish) the activity $j$ cannot end until activity $i$ has ended. 
Type 4:(Start-Finish) the activity $j$ cannot end until activity $i$ has started.

All these precedences can be written only as type 1. It should be noted that precedence type 1 implies type 2, and type 2 implies type 4. On the other hand, precedence type 1 implies type 3, and type 3 implies type 4.

## Constructing the PDM 

We willconstruct a matrix which indicates the order of precedence type 1 and 2 between the activities (Default=matrix(0)). If value $(i, j)$ = 1 then activity $i$ precedes type 1 to $j$, and if $(i, j)$ = 2 then activity $i$ precedes type 2 to $j$.As we know ycles cannot exist in a project, i.e. if an activity $i$ precedes $j$ then $j$ cannot precede $i$.

For precedence type 3 and 4 between the activities (Default=matrix(0)). If value $(i, j) = 3$ then activity $i$ precedes type 3 to $j$, and if $(i, j) = 4$ then activity $i$ precedes type 4 to $j$

So there are 4 types of indicating an activity in a precedence matrix: 
Type 1 : $FS_{ij}$ 
Type 2 : $SS_{ij}$ 
Type 3 : $FF_{ij}$ 
Type 4 : $SF_{ij}$ 

## Matrix of Problem 6 

For our problem all the activities are of Type 1 :$FS_{ij}$.So we have:

```{r}

D = matrix(c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
             0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
             0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
             0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
             0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,
             0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,
             0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,
             0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
             0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
             0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,
             0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,
             0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,
             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,
             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
             0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
             0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0),19,19,byrow =TRUE) 

colnames(D) = c("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S")
rownames(D) = c("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S")
D
```

##  Vector with elements the duration of each activity  

Here we have added two slack activities $P_{1},P_{2}$ with duration both 0 
```{r}
duration = c(0,1,1,2,1,2,1,1,2,3,2,3,3,3,3,2,2,0,0)
```




## Earliest Time of the Project

```{r}
earliest = early.time(prec1and2=D,duration=duration)
earliest
max(earliest)
```

## Latest Time of the Project

```{r}
latest = last.time(prec1and2=D,duration=duration,early.times=earliest)
latest
max(latest)

```



```{r}
ID6       = c(1:19)
names     = c("T1","T2","T3","T4","T5","T6","T7","T8","T9","T10","T11","T12","T13","T14","T15","T16","T17","P1","P2")
duration  = c(0,1,1,2,1,2,1,1,2,3,2,3,3,3,3,2,2,0,0)
pred      = c(" ","1","1","2,3","4","4,5","6","5","6","7","8,18","10","11","12","13","14","14,19","7,9","15,16")
pred      = as.factor(pred);class(pred)
data6     = data.frame(ID6,names,duration,pred);data6
res6      = critical_path(data6)
```





## Critical Path of the Project 

```{r}
res6$critical_path
```



## Duration of the Project 

```{r}
res6$total_duration
```

## Gannt Chart of the Project 

```{r}
gantt(data6,bar_size = 5, text_size = 3)
gantt(res6,bar_size = 5, text_size = 3)
```


## Network Diagram 

```{r}
network_diagram(data6)
```


```{r}
network_diagram(res6)
```

! Package inputenc Error: Unicode character Μ (U+039C)
(inputenc) not set up for use with LaTeX.

Try other LaTeX engines instead (e.g., xelatex) if you are using pdflatex. For R Markdown users, see https://bookdown.org/yihui/rmarkdown/pdf-document.html
Error: LaTeX failed to compile Untitled.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Untitled.log for more info.
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Execution halted