2020-08-14 13:36:36 +02:00

563 lines
26 KiB
R
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Sys.setlocale(category = "LC_ALL", locale = "slovenian")
libraries <- c('tools', 'psych', 'Hmisc', 'reports', 'fmsb','car','Cairo','openxlsx','gridExtra','ggplot2','Rcpp','grid','scales','plotrix','TeachingDemos')
lapply(libraries, FUN = function(y) {
do.call('require', list(y))})
library(scales)
#install.packages("Rcpp")
#install.packages("ggplot")
#install.packages("grid")
#install.packages("plotrix")
#install.packages("TeachingDemos")
dir.create('modules/mod_EVOLI/results', showWarnings=FALSE)
dir.create('modules/mod_EVOLI/results/slike', showWarnings=FALSE)
podatki <- read.csv2("modules/mod_EVOLI/temp/evoli.csv",sep=";", header=T, fill=T, stringsAsFactors=FALSE, encoding='UTF-8')
if (podatki[1,1]==("Ustreznost") | podatki[1,1]==("Relevance")) {podatki <- podatki[2:nrow(podatki),]}
source('modules/mod_EVOLI/R/SPSS_rekodiranje.R')
### SAMO ZA TERTIRANJE ###
# Uporabimo za testiranje, ker delamo za posameznika v datoteki pa imamo dva, najprej izberemo prvo vrstico.
podatki <- podatki[1,]
####
# pretvorba imen stolpcev in vrstic tabel za latex znake
toLatex <- function(tabela) {
if (!is.null(colnames(tabela))) {
colnames(tabela) <- Hmisc::latexTranslate(colnames(tabela))
}
if (!is.null(rownames(tabela))) {
rownames(tabela) <- Hmisc::latexTranslate(rownames(tabela))
}
return(tabela)
}
##
#######################
#My Overall EQ Profile
######################
# Skupni dose?ek
Overall_EQ_pojasnilo <- paste0("\\textbf{What does your score indicate?} \\newline The total EQ score
indicates the combined score over the 5 main areas and 15 components of Emotional
Intelligence. The scores are plotted on a bell curve and the normal range of
scores is between 80 and 120.")
# Trenutno ne uporabljamo interpretacij
Overall_EQ_pojasnilo <- NULL
pdf(paste('modules/mod_EVOLI/results/slike/EQ.pdf', sep=''), family='sans', pointsize=12, width=9, height=7)
par(mar = c(12, 2, 12, 2))
#par(bg = "gray") # background color of picture
plot(0, type="n", ylim=c(-1, 1), xlim=c(0, 200), axes = F, bty = "n",ylab="", xlab="")
#text(cex=1, x=-0.4, y=0, "Total\nEQ\nSCORE", xpd=NA, pos=2)
#mtext(podatki$totaleq, side = 1, line = 0, at = 15,cex = 2.4)
mtext(expression(paste(bold("My Total EQ SCORE"))), side = 3, line = 3, at = 100,cex = 2)
mtext(expression(paste("My emotional Intelligence Quotient")), side = 3, line = 1.4, at = 100,cex = 1.5)
mtext(expression(paste("Total EQ SCORE")), side = 3, line = -15, at =-1,cex = 1,outer = T)
axis(1, at=seq(0, 40, by=40),cex.axis=1.6,col.axis="black")
axis(1, at=seq(40, 60, by=20),lwd=1,cex.axis=1.6,labels=FALSE,col.axis="black")
axis(1, at=seq(60, 80, by=20),lwd=1,cex.axis=1.6,col.axis="black")
axis(1, at=seq(60, 80, by=20),lwd=1,cex.axis=1.6,labels=FALSE,col.axis="black")
axis(1, at=seq(80, 120, by = 40),lwd=1,cex.axis=1.6,col.axis="black")
axis(1, at=seq(120, 140, by = 20),lwd=1,cex.axis=1.6,labels=FALSE,col.axis="black")
axis(1, at=seq(140, 160, by = 20),lwd=1,cex.axis=1.6,col.axis="black")
axis(1, at=seq(160, 200, by = 40),lwd=1,cex.axis=1.6,col.axis="black")
axis(1, at=100,lwd=1,cex.axis=1.6,col.axis="black")
#axis(1, at=c(40, 60,80,120,140,160),lwd=2)
axis(3, at = NULL,labels = FALSE,tick = T, outer = F,lwd.ticks=0,lwd=2)
abline(v=c(20,40,60,80,120,140,160,180), col=c("gray"), lty=c(1), lwd=c(0.1))
abline(v=c(0,200), col=c("black"), lty=c(1), lwd=c(1))
abline(v=c(100), col=c("black"), lty=c(1), lwd=c(3))
# Sivo ozadje grafa
#rect(par("usr")[1],par("usr")[3],par("usr")[2],par("usr")[4],col = "gray")
#rect(0, -.1, podatki$totaleq, .1, col=colfunc, border=1,lwd=1)
# Da dobimo barvno paleto uporabimo funkcijo gradient.rect
gradient.rect(0,-.5,podatki$totaleq,.5,col=smoothColors("Steel Blue 1",100.0,"Blue"),border=0,gradient="x")
#text(podatki$totaleq, 0, pos=2, label=podatki$totaleq,cex=2.4, col="white")
#install.packages("TeachingDemos") #sen?en tekst
#library(TeachingDemos)
# Sen?enje tekstapodatkovni.okvir_action_plann
shadowtext(podatki$totaleq, y =0, pos=2,label=podatki$totaleq, col="yellow", bg = "yellow",cex=2.4,r=0.1)
#box()
#box("figure", lwd = 10)
dev.off()
tex.EQ <- c(paste0("\\begin{figure}[H]",
paste0("\\centerline{\\includegraphics[width=0.75\\textwidth]{slike/EQ.pdf}}"),
"\\end{figure}",Overall_EQ_pojasnilo))
## //My Overall EQ Profile// ##
#########################################
#Five Areas of Emotional Intelligence
#########################################
vaja <- c(podatki$saw,podatki$sma,podatki$smo,podatki$soa,podatki$ssk)
text.decimalno.mesto <- sprintf("%.1f", vaja)
#vaja <- as.factor(vaja)
if (any(!is.na(vaja))) {
pdf(paste('modules/mod_EVOLI/results/slike/EQ_barplot.pdf', sep=''), family='sans', pointsize=11, width=11, height=8)
Names <- c("Self-awarenes","Self-management",
"Self-motivation", "Social awareness","Social skills")
# add \n
Names[seq(2, length(Names), 2)] <- paste0("\n" ,Names[seq(2, length(Names), 2)])
# data.frame, including a grouping vector
d <- data.frame(Names, vaja, group=c(rep("Intrapersonal capacity", 3), rep("Interpersonal capacity", 2)))
# correct order
#d$Names <- factor(d$Names, levels= c("Self Awarenes","Self Management",
# "Self Motivation", "Social Awareness","Social Skills"))
d$group_f = factor(d$group, levels=c('Intrapersonal capacity','Interpersonal capacity'))
d$Names <- factor(d$Names, levels= unique(d$Names))
# plot the bars
p1 <- ggplot(d, aes(x= Names, y= vaja, group= group, fill=vaja,order=vaja)) +
geom_bar(stat= "identity", fill="blue") +
theme_bw()
# use facet_grid for the groups
#p + facet_grid(.~group_f, scales= "free_x", space= "free_x")
p2 <- p1+ theme(text = element_text(size=23),plot.background = element_rect(fill = "white"), strip.background = element_rect(fill="Blue")) +
scale_y_continuous(expand = c(0, 0), limits = c(0,10.3)) + xlab("") +ylab("")+ theme(legend.position="none")+
facet_grid(.~group_f, scales= "free_x", space= "free_x") +
theme(strip.text.x = element_text(size = 25, colour = "white"),panel.grid.major.x = element_blank()) +
scale_fill_gradient(low="Steel Blue 1",high="blue")+
annotation_custom(
grid::rasterGrob(paste0("#CAE1FF", as.hexmode(1:120)),
width=unit(1,"npc"),
height = unit(1,"npc"),
interpolate = TRUE),
xmin=0.55, xmax=1.45, ymin=0, ymax=4
) +
annotation_custom(
grid::rasterGrob(paste0("#CAE1FF", as.hexmode(1:120)),
width=unit(1,"npc"),
height = unit(1,"npc"),
interpolate = TRUE),
xmin=1.54, xmax=2.45, ymin=0, ymax=4
) +
annotation_custom(
grid::rasterGrob(paste0("#CAE1FF", as.hexmode(1:120)),
width=unit(1,"npc"),
height = unit(1,"npc"),
interpolate = TRUE),
xmin=2.52, xmax=3.45, ymin=0, ymax=5
) +
annotation_custom(
grid::rasterGrob(paste0("#CAE1FF", as.hexmode(1:120)),
width=unit(1,"npc"),
height = unit(1,"npc"),
interpolate = TRUE),
xmin=3.55, xmax=4.45, ymin=0, ymax=5
) +
annotation_custom(
grid::rasterGrob(paste0("#CAE1FF", as.hexmode(1:120)),
width=unit(1,"npc"),
height = unit(1,"npc"),
interpolate = TRUE),
xmin=4.55, xmax=5.48, ymin=0, ymax=5
) + geom_text(aes(label=text.decimalno.mesto),color="yellow", y=1, size=9.5, fontface=2,lineheight=0.1)
d <- p2 + theme(panel.margin = unit(0, "lines"))
#d1 <- d+ggtitle(expression(atop(bold("My Detailed EQ Profile"), atop(plain("My Scores for the 5 Areas of Emotional Intelligence"), ""))))
d1 <- d
g <- ggplotGrob(d1)
g$heights[[3]] = unit(0.6,"in")
grid.newpage()
grid.draw(g)
dev.off()
tex.EQ_barplot <- c(paste0(
"\\begin{figure}[H]",
"\\caption{ \\textbf{\\large{My Detailed EQ Profile}}}",
"\\caption{My Scores for the 5 Areas of Emotional Intelligence}",
"\\caption{}",
paste0("\\centerline{\\includegraphics[page=2,width=0.75\\textwidth]{slike/EQ_barplot.pdf}}"),
"\\end{figure}")
)
EQ_barplot <- c(paste0(tex.EQ_barplot))
} else{tex.EQ_barplot <- NULL
EQ_barplot <- NULL}
# Trenutno ne potrebujemo interpretacij
# Interpretacija komponent
#komponente <- c(paste0(
# "\\begin{figure}[H]",
# "\\caption{ \\textbf{\\large{My Detailed EQ Profile}}}",
# "\\caption{My Scores for the 5 Areas of Emotional Intelligence}",
# "\\caption{}",
# paste0("\\centerline{\\includegraphics[width=0.85\\textwidth]{../latexkosi/logo/Komponente.png}}"),
# "\\end{figure}")
#)
# NOT USING THIS NOW
komponente <- NULL
## //Five Areas of Emotional Intelligence// ##
###########################################################
###############My Detailed EQ Profile######################
#My Scores for the 15 Components of Imotional Intelligence
##########################################################
value <- c(podatki$sar,podatki$esr,podatki$obr,podatki$ser,
podatki$smr,podatki$icr,podatki$srr,podatki$adr,
podatki$psr,podatki$opr,podatki$acr,podatki$cor,
podatki$emr,podatki$irr,podatki$gor)
names <- c("Self-appraisal","Emotional self-awareness",
"Objectivity","Self-expression","Stress management",
"Impulse control", "Self-reliance","Adaptability",
"Problem-solving","Optimism","Achievement drive","Contentment",
"Empathy","Interpersonal relations","Group orientation")
df <- data.frame(value, names)
df$names <- as.character(df$names)
df$names <- factor(df$names, levels=rev(unique(df$names)))
df$names = factor(df$names,
levels = c( "Group orientation",
"Interpersonal relations",
"Empathy",
"Contentment",
"Achievement drive",
"Optimism",
"Problem-solving",
"Adaptability",
"Self-reliance",
"Impulse control",
"Stress management",
"Self-expression",
"Objectivity",
"Emotional self-awareness",
"Self-appraisal"),
ordered=T)
if (any(!is.na(df$value))) {
pdf(paste('modules/mod_EVOLI/results/slike/EQ_lineplot.pdf', sep=''), family='sans', pointsize=15, width=7.5, height=7.5)
p <- ggplot(data = df, aes(y = value,x= names,group=1))+ geom_point(color = I(" Navy Blue"),shape=21, lwd=3,fill=" Navy Blue")+
geom_line(group = I(1),color = I("blue"))+
theme_bw()+coord_flip() + xlab("") +ylab("") + theme(axis.text=element_text(size=11,face="bold"))
#p1 <- p + annotate("rect", xmin = 0, xmax = 10, ymin = 15.2, ymax =15.3, alpha=1,fill = "blue") +
# annotate("rect", xmin = 0, xmax = 10, ymin = 11.2, ymax =11.3, alpha=1,fill = "blue") +
#annotate("rect", xmin = 0, xmax = 10, ymin = 6.2, ymax =6.3, alpha=1,fill = "blue") +
#annotate("rect", xmin = 0, xmax = 10, ymin = 3.2, ymax =3.3, alpha=1,fill = "blue") +
#annotate("rect", xmin = 0, xmax = 10, ymin = 2.2, ymax =2.3, alpha=1,fill = "blue") +
#scale_x_continuous(minor_breaks = seq(1,10,2.5), breaks = seq(min(0,5), max(10), by = 2.5), limits=c(0,10),oob = rescale_none)+
#theme(plot.background = element_rect(fill = "white")) + xlab("") +ylab("")
p2 <- p + scale_y_continuous(expand=c(0,0),minor_breaks = seq(0,10,0.5), breaks = seq(min(0,5), max(10), by = 2.5), limits=c(0,10),oob = rescale_none) +
theme(panel.border = element_blank(),plot.background = element_rect(fill = "white"),panel.grid.minor = element_line(colour = "gray",size=0.1)) +
geom_hline(yintercept = 0.0, col="black",alpha=0.6) +
geom_hline(yintercept = 2.5, col="black",alpha=0.6) +
geom_hline(yintercept = 7.5, col="black", alpha=0.6) +
geom_hline(yintercept = 10.0, col="black", alpha=0.6)
p2 <- p2+ theme(plot.margin = unit(c(1,1,0,6.3), "cm"))
# Sivo ozadje grafa
p2 <- p2 + annotate("rect", xmin = 11.5, xmax = 15.6, ymin = -8.5, ymax =10, alpha=0.5,fill = "gray") +
annotate("rect", xmin = 3.5, xmax = 6.5, ymin = -8.5, ymax =10, alpha=0.5,fill = "gray") +
annotate("rect", xmin = 0, xmax = 2.5, ymin = -8.5, ymax =10, alpha=0.5,fill = "gray") +
geom_point(color = I(" Navy Blue"),shape=21, lwd=3,fill=" Navy Blue")+
geom_line(group = I(1),color = I("blue"))
#annotate("rect", xmin = 3.5, xmax = 6.5, ymin = -8.5, ymax =10.3, alpha=0.3,fill = "gray") +
#annotate("rect", xmin = 0.1, xmax = 2.5, ymin = -8.5, ymax =10.3, alpha=0.3,fill = "gray")
#p2 +annotation_custom(grob = linesGrob(), xmin = 9, xmax = 12, ymin = 1, ymax = 1)
#grid.lines(x=unit(0.1,"npc"), y = unit(0.80,"npc"), default.units='native' )
#+annotate(geom = "text", x= 15 ,y = 5, label = "your label")
# Create the text Grobs
myGrob2 <- grobTree(rectGrob(gp=gpar(col="blue2",fill="blue2", alpha=1)),
segmentsGrob(x0=10, x1=15, y0=-4, y1=-3, default.units="npc"))
# Add the annotations
# Segment 1
pp =p2 +
annotation_custom(grob = linesGrob(gp=gpar(col = "gray")), xmin = 0.0, xmax = 15.6, ymin = -8.5, ymax = -8.5) +
#annotation_custom(grob = linesGrob(), xmin = 11.6, xmax = 11.6, ymin = -8.5, ymax = -7.1) +
annotation_custom(grob = linesGrob(gp=gpar(col = "gray")), xmin = 15.6, xmax = 15.6, ymin = -8.5, ymax = 0) +
annotation_custom(grob = linesGrob(gp=gpar(col = "gray")), xmin = 11.5, xmax = 11.5, ymin = -8.5, ymax = 10) +
annotation_custom(grob = linesGrob(gp=gpar(col = "gray")), xmin = 6.5, xmax = 6.5, ymin = -8.5, ymax = 10) +
annotation_custom(grob = linesGrob(gp=gpar(col = "gray")), xmin = 3.5, xmax = 3.5, ymin = -8.5, ymax = 10) +
annotation_custom(grob = linesGrob(gp=gpar(col = "gray")), xmin = 2.5, xmax = 2.5, ymin = -8.5, ymax = 10) +
#annotation_custom(grob = linesGrob(), xmin = 6.7, xmax = 6.7, ymin = -8.5, ymax = -7.1) +
#annotation_custom(grob = linesGrob(), xmin = 11.2, xmax = 11.2, ymin = -8.5, ymax = -7.1) #+
#annotation_custom(grob = linesGrob(), xmin = 3.9, xmax = 6.3, ymin = -8.5, ymax = -8.5) +
#annotation_custom(grob = linesGrob(), xmin = 3.9, xmax = 3.9, ymin = -8.5, ymax = -7.1) +
#annotation_custom(grob = linesGrob(), xmin = 6.3, xmax = 6.3, ymin = -8.5, ymax = -7.1) +
#annotation_custom(grob = linesGrob(), xmin = 2.8, xmax = 3.5, ymin = -8.5, ymax = -8.5) +
#annotation_custom(grob = linesGrob(), xmin = 2.8, xmax = 2.8, ymin = -8.5, ymax = -7.1) +
#annotation_custom(grob = linesGrob(), xmin = 3.5, xmax = 3.5, ymin = -8.5, ymax = -7.1) +
#annotation_custom(grob = linesGrob(), xmin = 0.8, xmax = 2.4, ymin = -8.5, ymax = -8.5) +
#annotation_custom(grob = linesGrob(), xmin = 0.8, xmax = 0.8, ymin = -8.5, ymax = -7.1) +
annotation_custom(grob = linesGrob(gp=gpar(col = "gray")), xmin = 0, xmax = 0, ymin = -8.5, ymax = 0) +
# Pravokotniki
#annotation_custom(myGrob2, xmin = 13.5, xmax = 14.3, ymin = -15, ymax = -9) +
#annotation_custom(myGrob2, xmin = 9.3, xmax = 10.1, ymin = -15, ymax = -9) +
#annotation_custom(myGrob2, xmin = 5.2, xmax = 6.0, ymin = -15, ymax = -9) +
#annotation_custom(myGrob2, xmin = 3.2, xmax = 4.0, ymin = -15, ymax = -9) +
#annotation_custom(myGrob2, xmin = 1.3, xmax = 2.1, ymin = -15, ymax = -9) +
# Dodamo markerje pri drugi x osi oziroma pri osi nad grafom. Markerji naj bodo na vrednostih 0, 2.5, 5.0, 7.5, 10.0.
annotation_custom(grob = linesGrob(), xmin = 15.6, xmax = 15.67, ymin = 0, ymax = 0) +
annotation_custom(grob = linesGrob(), xmin = 15.6, xmax = 15.67, ymin = 2.5, ymax = 2.5) +
annotation_custom(grob = linesGrob(), xmin = 15.6, xmax = 15.67, ymin = 5.0, ymax = 5.0) +
annotation_custom(grob = linesGrob(), xmin = 15.6, xmax = 15.67, ymin = 7.5, ymax = 7.5) +
annotation_custom(grob = linesGrob(), xmin = 15.6, xmax = 15.67, ymin = 10.0, ymax = 10.0) +
geom_hline(yintercept = 5, size = 0.6) +
geom_hline(yintercept = 0.5, size = 0.1, col="gray") +
geom_hline(yintercept = 1.0, size = 0.1, col="gray") +
geom_hline(yintercept = 1.5, size = 0.1, col="gray") +
geom_hline(yintercept = 2.0, size = 0.1, col="gray") +
geom_hline(yintercept = 3.0, size = 0.1, col="gray") +
geom_hline(yintercept = 3.5, size = 0.1, col="gray") +
geom_hline(yintercept = 4.0, size = 0.1, col="gray") +
geom_hline(yintercept = 4.5, size = 0.1, col="gray") +
geom_hline(yintercept = 5.5, size = 0.1, col="gray") +
geom_hline(yintercept = 6.0, size = 0.1, col="gray") +
geom_hline(yintercept = 6.5, size = 0.1, col="gray") +
geom_hline(yintercept = 7.0, size = 0.1, col="gray") +
geom_hline(yintercept = 8.0, size = 0.1, col="gray") +
geom_hline(yintercept = 8.5, size = 0.1, col="gray") +
geom_hline(yintercept = 9.0, size = 0.1, col="gray") +
geom_hline(yintercept = 9.5, size = 0.1, col="gray") +
# Da sivo ozadnje ne prekrije modre barve, ?e nekrat naredimo modro ?rto in to?ke
geom_point(color = I(" Navy Blue"),shape=21, lwd=3,fill=" Navy Blue") +
geom_line(group = I(1),color = I("blue"),size=1)
gt <- ggplot_gtable(ggplot_build(pp))
gt$layout$clip[gt$layout$name=="panel"] <- "off"
grid.draw(gt)
#################################################
############################
#5 KOMPONENT IN JIHOVE OCENE
############################
# Tekst komponent in vrednosti na desni strani grafa, ki so desno poravnane
grid.text((paste("Self-awareness")),
x = unit(0.22, "npc"), y = unit(0.815, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold",fontsize = 14, col = "blue"))
grid.text((paste0(podatki$saw,".0")),
x = unit(.32, "npc"), y = unit(0.81, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold", fontsize = 19, col = "blue"))
grid.text((paste("Self-management")),
x = unit(0.22, "npc"), y = unit(0.565, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold",fontsize = 14, col = "blue"))
grid.text((paste0(podatki$sma,".0")),
x = unit(.32, "npc"), y = unit(0.56, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold", fontsize = 19, col = "blue"))
#grid.text((paste0(podatki$sma,",0")),
# x = unit(.09, "npc"), y = unit(0.53, "npc"), just = c("left", "bottom"),
# gp = gpar(fontface = 4, fontsize = 23, col = "white",alpha=0.5))
grid.text((paste("Self-motivation")),
x = unit(0.22, "npc"), y = unit(0.33, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold",fontsize = 14, col = "blue"))
grid.text((paste0(podatki$smo,".0")),
x = unit(.32, "npc"), y = unit(0.325, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold", fontsize = 19, col = "blue"))
grid.text((paste("Social awareness")),
x = unit(0.22, "npc"), y = unit(0.215, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold",fontsize = 14, col = "blue"))
grid.text((paste0(podatki$soa,".0")),
x = unit(.32, "npc"), y = unit(0.21, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold", fontsize = 19, col = "blue"))
grid.text((paste("Social skills")),
x = unit(0.22, "npc"), y = unit(0.115, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold",fontsize = 14, col = "blue"))
grid.text((paste0(podatki$ssk,".0")),
x = unit(.32, "npc"), y = unit(0.11, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold", fontsize = 19, col = "blue"))
# Ker ?ekimo imeti dvojno X os, NE uporabimo (zaradi risanja) kode:
#install.packages("cowplot")
#require(cowplot)
#ggdraw(switch_axis_position(p2 + theme_bw(), axis = 'x', keep = 'x'))
# Ampak to ro?no naredimo oz ro?no dodamo ?tevilke na posamezno os
grid.text((paste0("0.0")),
x = unit(.611, "npc"), y = unit(0.955, "npc"), just = c("left", "bottom"),
gp = gpar(fontface = "bold",fontsize = 11, col = "black"))
grid.text((paste0("2.5")),
x = unit(.6921, "npc"), y = unit(0.955, "npc"), just = c("left", "bottom"),
gp = gpar(fontface = "bold",fontsize = 11, col = "black"))
grid.text((paste0("5.0")),
x = unit(.77228, "npc"), y = unit(0.955, "npc"), just = c("left", "bottom"),
gp = gpar(fontface = "bold",fontsize = 11, col = "black"))
grid.text((paste0("7.5")),
x = unit(.852112, "npc"), y = unit(0.955, "npc"), just = c("left", "bottom"),
gp = gpar(fontface = "bold",fontsize = 11, col = "black"))
grid.text((paste0("10.0")),
x = unit(.9215, "npc"), y = unit(0.955, "npc"), just = c("left", "bottom"),
gp = gpar(fontface = "bold",fontsize = 11, col = "black"))
dev.off()
EQ_lineplot_pojasnilo <- paste0("\\textbf{How to interpret your results}: \\newline
If the score is below 2.5, this component could be an area of concern. Scores that fall between 2.5 and 7.5
indicate that the component can be taken to the next level. If any score is above 7.5, this component could be a
strength that can be leveraged to support you in your work.")
# Ne potrebujemo interpretacij
EQ_lineplot_pojasnilo <- NULL
tex.EQ_lineplot <- c(paste0(
"\\begin{figure}[H]",
"\\caption{ \\textbf{\\large{My Detailed EQ Profile}}}",
"\\caption{My Scores for the 15 Components of emotional Intelligence}",
paste0("\\centerline{\\includegraphics[width=1\\textwidth]{slike/EQ_lineplot.pdf}}"),
"\\end{figure}"),EQ_lineplot_pojasnilo)
} else {tex.EQ_lineplot <- NULL}
## //My Detailed EQ Profile// ##
# Zapi?emo ?e ime respondenta, organizacije in datum testiranja
# Name
junk <- c("-1","-2", "-3", "-4", "-5")
if (!is.null(podatki$Q1)) {
if (length(podatki$Q1)>0 & !(podatki$Q1 %in% junk)) {
respondent <- paste(podatki[["Q1"]],podatki[["Q14"]], sep=" ") # Izpis imena kandidata, ki se ga ocenjuje na prvi strani
# respondent <- gsub('ą', 'š', respondent,fixed=T) # Pravilni izpis šumnika
# respondent <- gsub('˛a', 'š', respondent,fixed=T) # Pravilni izpis šumnika
# respondent <- gsub('©', 'Š', respondent, fixed=T)
# respondent <- gsub('®', 'Ž', respondent,fixed=T)
# respondent <- gsub('\u017E', 'ž', respondent,fixed=T)
} else {respondent <- " "}
# Organisation
if (length(podatki$Q15)>0 & !(podatki$Q15 %in% junk)) {
Organisation <- podatki[["Q15"]] # izpis osebe, ki je pripravila poročilo
# Organisation <- gsub('ą', 'š', Organisation,fixed=T) # Pravilni izpis šumnika
# Organisation <- gsub('ą', 'š', Organisation,fixed=T) # Pravilni izpis šumnika
# Organisation <- gsub('©', 'Š', Organisation, fixed=T)
# Organisation <- gsub('®', 'Ž', Organisation,fixed=T)
# Organisation <- gsub('\u017E', 'ž', Organisation,fixed=T)
} else {Organisation <- " "}
# Date of testing
if (length(podatki$itime)>0 & !(podatki$itime %in% junk)) {
date <- podatki[["itime"]] # izpis osebe, ki je pripravila poročilo
} else {date <- " "}
if (length(podatki$Q1)>0 & !(podatki$Q1 %in% junk)) {
respondent.nagovor <- podatki[["Q1"]] # Izpis imena kandidata, ki se ga ocenjuje v nagovoru
# respondent.nagovor <- gsub('ą', 'š', respondent.nagovor,fixed=T) # Pravilni izpis šumnika
# respondent.nagovor <- gsub('©', 'Š', respondent.nagovor, fixed=T)
# respondent.nagovor <- gsub('®', 'Ž', respondent.nagovor,fixed=T)
# respondent.nagovor <- gsub('\u017E', 'ž', respondent.nagovor,fixed=T)
} else {respondent.nagovor <- " "}
} else {respondent <- " "
Organisation <- " "
date <- " "
respondent.nagovor <- " "}
Sys.setlocale("LC_ALL", "Czech")
##Metodologija na za?etku
podatkovni.okvir <- scan("modules/mod_EVOLI/latexkosi/pojasnilo_ang.tex", character(0), sep="\n", quiet=TRUE,encoding='UTF-8')
podatkovni.okvir <- gsub(pattern='!name.address!', replacement=Hmisc::latexTranslate(respondent.nagovor), x=podatkovni.okvir) # Naslov porocila na prvi strani
tabela.5.komponent.tex <- scan("modules/mod_EVOLI/latexkosi/tabela_The 5_areas_ang.tex", character(0), sep="\n", quiet=TRUE,encoding='UTF-8')
tabele.15.komponent.tex <- scan("modules/mod_EVOLI/latexkosi/tabela_The 15_components_ang.tex", character(0), sep="\n", quiet=TRUE,encoding='UTF-8')
pojasnilo.konec.tex <- scan("modules/mod_EVOLI/latexkosi/pojasnilo.konec_ang.tex", character(0), sep="\n", quiet=TRUE,encoding='UTF-8')
##Generiranje PDF
tex.glava <- scan("modules/mod_EVOLI/latexkosi/glava-evoli_ang.tex", character(0), sep="\n", quiet=TRUE,encoding='UTF-8')
#tex.glava <- gsub(pattern='!encoding_r!', tolower(gsub("-","",localeToCharset(locale=Sys.getlocale("LC_CTYPE")))), x=tex.glava)
tex.noga <- scan("modules/mod_EVOLI/latexkosi/z-noga.tex", character(0), sep="\n", quiet=TRUE)
tex.glava <- gsub(pattern='!name!', replacement=Hmisc::latexTranslate(respondent), x=tex.glava) # Naslov poro?ila na prvi strani
tex.glava <- gsub(pattern='!organisation!', replacement=Hmisc::latexTranslate(Organisation), x=tex.glava) # Naslov poro?ila na prvi strani
tex.glava <- gsub(pattern='!date!', replacement=Hmisc::latexTranslate(date), x=tex.glava) # Naslov poro?ila na prvi strani
Rdirektorij <- getwd()
tex.izbor <- c(tex.glava, "\\newpage",
podatkovni.okvir,
"\\newpage", "\\vspace*{-2.8cm}", tex.EQ,
"\\newpage",EQ_barplot,
komponente, "\\vspace{2.4cm}",
tabela.5.komponent.tex,
"\\newpage",tex.EQ_lineplot,
"\\newpage",
tabele.15.komponent.tex,
pojasnilo.konec.tex,
tex.noga)
tex.izbor <- gsub(pattern='!name!', replacement=Hmisc::latexTranslate(respondent), x=tex.izbor) # Naslov poro?ila na prvi strani
#pdf_name <- gsub("[[:space:]]", "_", respondent)
#pdf_name <- gsub("\\?", "o", pdf_name)
setwd(paste(Rdirektorij, "modules/mod_EVOLI/results", sep="/"))
cat(tex.izbor, file = paste('PEQM-EN.tex', sep = ''), sep = '\n')
tools::texi2pdf(file=paste0("PEQM-EN.tex"), quiet=TRUE, clean=TRUE)
setwd(Rdirektorij)