Popravek R kode, ki generira NIJZ poročilo

This commit is contained in:
Miha 2021-10-19 19:54:30 +02:00
parent af5bfa4ad2
commit 7fa616af7b

View File

@ -107,6 +107,8 @@ data <- read.csv2(paste0(
# Remove missing values
data <- as.data.frame(data)
colnames(data)[1] <- "V1"
colnames(data)[2] <- "V2"
#--------------------------- // READ DATA // ------------------------#
@ -121,16 +123,17 @@ CairoPNG('modules/mod_NIJZ/results/img/radar.png', width = 900, height = 700) #
# height = 8.5
# )
# Create rang which will be labeld in grapf (10 likert scale)
myrange <- c(0, 7)
steviloVrstic <- nrow(data) - 5
myrange <- c(0, steviloVrstic)
# create a data frame with the max and min as the first two rows
mydf <-
as.data.frame(rbind(max = myrange[2], min = myrange[1], as.numeric(data[1:7,]$V2)),
as.data.frame(rbind(max = myrange[2], min = myrange[1], as.numeric(data[1:steviloVrstic,]$V2)),
stringsAsFactors = FALSE)
# Add names which will be displayed as labels in
# chart and also their means in parentheses
labels <- gsub('(.{1,20})(\\s|$)', '\\1\n', data[1:7,]$V1)
labels <- gsub('(.{1,20})(\\s|$)', '\\1\n', data[1:steviloVrstic,]$V1)
colnames(mydf) <- labels
# Deljenje besed zaradi preglednosti