---
title: "MMZI -- kolokvij 1"
subtitle: "Analiza bodova i utrošenog vremena"
output: html_document
---

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

### Učitavanje paketa

```{r message=FALSE}
library(tidyverse)
```

### Učitavanje podataka

```{r warning=FALSE}
podaci <- read.csv("kol1.csv")
podaci2 <- podaci %>% transmute(student = paste(Prezime, Ime), 
           Vrijeme = as.numeric(difftime(as.POSIXct(Završeno, format="%d. %B %Y. %H:%M"),
                                         as.POSIXct(Započeto, format="%d. %B %Y. %H:%M"),
                                         units='mins')), Bodovi = round(Bodovi)) %>% 
           filter(student != "Ukupni prosjek ")
```

### Studenti s brojem bodova između 16 i 20

```{r warning=FALSE}
bodovi16 <- podaci2 %>% filter(Bodovi >= 16)
length(bodovi16$student)
```

```{r warning=FALSE, fig.width=9, fig.height=6}
ggplot(bodovi16) + geom_point(aes(x=Vrijeme, y=student),size=6, color="#2266ee") +
  geom_segment(aes(x=Vrijeme, y=student, xend = Bodovi, yend = student), size = 2, color="#2266ee") +
  geom_point(aes(x=Bodovi, y=student),size=6, color="#ff5589") +
  geom_segment(aes(x=Bodovi, y=student, xend = 0, yend = student), size = 2, color="#ff5589") +
  geom_text(aes(x=Vrijeme, y=student, label = Vrijeme), color = "white", size = 3) +
  geom_text(aes(x=Bodovi, y=student, label = Bodovi), color = "white", size = 3) +
  labs(x="Bodovi / Vrijeme (min)")
```


### Studenti s brojem bodova 14 ili 15

```{r warning=FALSE}
bodovi14do15 <- podaci2 %>% filter(Bodovi %in% 14:15)
length(bodovi14do15$student)
```

```{r warning=FALSE, fig.width=9, fig.height=10}
ggplot(bodovi14do15) + geom_point(aes(x=Vrijeme, y=student),size=6, color="#2266ee") +
  geom_segment(aes(x=Vrijeme, y=student, xend = Bodovi, yend = student), size = 2, color="#2266ee") +
  geom_point(aes(x=Bodovi, y=student),size=6, color="#ff5589") +
  geom_segment(aes(x=Bodovi, y=student, xend = 0, yend = student), size = 2, color="#ff5589") +
  geom_text(aes(x=Vrijeme, y=student, label = Vrijeme), color = "white", size = 3) +
  geom_text(aes(x=Bodovi, y=student, label = Bodovi), color = "white", size = 3) +
  labs(x="Bodovi / Vrijeme (min)")
```

### Studenti s brojem bodova 12 ili 13

```{r warning=FALSE}
bodovi12do13 <- podaci2 %>% filter(Bodovi %in% 12:13)
length(bodovi12do13$student)
```

```{r warning=FALSE, fig.width=9, fig.height=10}
ggplot(bodovi12do13) + geom_point(aes(x=Vrijeme, y=student),size=6, color="#2266ee") +
  geom_segment(aes(x=Vrijeme, y=student, xend = Bodovi, yend = student), size = 2, color="#2266ee") +
  geom_point(aes(x=Bodovi, y=student),size=6, color="#ff5589") +
  geom_segment(aes(x=Bodovi, y=student, xend = 0, yend = student), size = 2, color="#ff5589") +
  geom_text(aes(x=Vrijeme, y=student, label = Vrijeme), color = "white", size = 3) +
  geom_text(aes(x=Bodovi, y=student, label = Bodovi), color = "white", size = 3) +
  labs(x="Bodovi / Vrijeme (min)")
```

### Studenti s brojem bodova 10 ili 11

```{r warning=FALSE}
bodovi10do11 <- podaci2 %>% filter(Bodovi %in% 10:11)
length(bodovi10do11$student)
```

```{r warning=FALSE, fig.width=9, fig.height=11}
ggplot(bodovi10do11) + geom_point(aes(x=Vrijeme, y=student),size=6, color="#2266ee") +
  geom_segment(aes(x=Vrijeme, y=student, xend = Bodovi, yend = student), size = 2, color="#2266ee") +
  geom_point(aes(x=Bodovi, y=student),size=6, color="#ff5589") +
  geom_segment(aes(x=Bodovi, y=student, xend = 0, yend = student), size = 2, color="#ff5589") +
  geom_text(aes(x=Vrijeme, y=student, label = Vrijeme), color = "white", size = 3) +
  geom_text(aes(x=Bodovi, y=student, label = Bodovi), color = "white", size = 3) +
  labs(x="Bodovi / Vrijeme (min)")
```

### Studenti s brojem bodova između 7 i 9

```{r warning=FALSE}
bodovi7do9 <- podaci2 %>% filter(Bodovi %in% 7:9)
length(bodovi7do9$student)
```

```{r warning=FALSE, fig.width=9, fig.height=16}
ggplot(bodovi7do9) + geom_point(aes(x=Vrijeme, y=student),size=6, color="#2266ee") +
  geom_segment(aes(x=Vrijeme, y=student, xend = Bodovi, yend = student), size = 2, color="#2266ee") +
  geom_point(aes(x=Bodovi, y=student),size=6, color="#ff5589") +
  geom_segment(aes(x=Bodovi, y=student, xend = 0, yend = student), size = 2, color="#ff5589") +
  geom_text(aes(x=Vrijeme, y=student, label = Vrijeme), color = "white", size = 3) +
  geom_text(aes(x=Bodovi, y=student, label = Bodovi), color = "white", size = 3) +
  labs(x="Bodovi / Vrijeme (min)")
```

### Studenti s brojem bodova između 0 i 6

```{r warning=FALSE}
bodovi6 <- podaci2 %>% filter(Bodovi %in% 0:6)
length(bodovi6$student)
```

```{r warning=FALSE, fig.width=9, fig.height=15}
ggplot(bodovi6) + geom_point(aes(x=Vrijeme, y=student),size=6, color="#2266ee") +
  geom_segment(aes(x=Vrijeme, y=student, xend = Bodovi, yend = student), size = 2, color="#2266ee") +
  geom_point(aes(x=Bodovi, y=student),size=6, color="#ff5589") +
  geom_segment(aes(x=Bodovi, y=student, xend = 0, yend = student), size = 2, color="#ff5589") +
  geom_text(aes(x=Vrijeme, y=student, label = Vrijeme), color = "white", size = 3) +
  geom_text(aes(x=Bodovi, y=student, label = Bodovi), color = "white", size = 3) +
  labs(x="Bodovi / Vrijeme (min)")
```