---
title: "eDesk"
author: "Damir Horvat"
date: "10/30/2021"
output: html_document
---

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

### Učitavanje paketa

```{r message=FALSE}
library(DT)
library(tidyverse)
library(readxl)
library(vtable)
library(corrplot)
library(xtable)
```

### Učitavanje podataka

```{r warning=FALSE}
podaci <- read_excel('podaci.xlsx', sheet=1)
imena <- names(podaci)
podaci2 <- podaci %>% rename_with(.fn = ~paste0("Q", substring(.,1,regexpr("\\.", .) - 1)), .cols = 9:length(imena))
data2 <- podaci2 %>% select(Q1:Q67)
```

### Ukupni kratki pregled

```{r warning=FALSE, fig.width=15, fig.height=15}
#st(podaci, add.median=TRUE)
```

### Kratki pregled po državama

```{r warning=FALSE}
#st(podaci, group = 'Country', add.median=TRUE, group.long = TRUE)
```


### Korelacije među pitanjima

```{r warning=FALSE}
res <- round(cor(data2, use = "pairwise.complete.obs"), 2)
datatable(
  res, extensions = c('FixedColumns','FixedHeader'),
  options = list(
    #dom = 't',
    pageLength = 15,
    scrollX = TRUE,
    fixedColumns = TRUE,
    fixedHeader = TRUE
  )
)
#kbl(res) %>%
#  kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"), font_size=10) %>%
#  scroll_box(width = "100%", height = "700px")
#knitr::kable(res, format = "pipe")
#print(xtable(res), type="html")
```

```{r warning=FALSE, fig.width=15, fig.height=15}
corrplot(res, type = "upper", tl.col = "black", tl.srt = 90)
```
