diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2022-01-11 12:35:47 +0100 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2022-01-11 12:35:47 +0100 |
commit | 19985dbb8c0aa66dc4bf7905abc1148de909097d (patch) | |
tree | 2cd5a5d20d7e80fc2a51adf60d838d8a2c40999e /admin/survey/modules/mod_kakovost/R/kakovost.R | |
download | 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.gz 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.bz2 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.lz 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.xz 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.zst 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.zip |
Diffstat (limited to 'admin/survey/modules/mod_kakovost/R/kakovost.R')
-rw-r--r-- | admin/survey/modules/mod_kakovost/R/kakovost.R | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/admin/survey/modules/mod_kakovost/R/kakovost.R b/admin/survey/modules/mod_kakovost/R/kakovost.R new file mode 100644 index 0000000..de05f1e --- /dev/null +++ b/admin/survey/modules/mod_kakovost/R/kakovost.R @@ -0,0 +1,47 @@ +#uporabnost <- function(params){
+
+#setwd("path od mape, kjer se nahaja ta glavna datoteka, npr. C:/mapa")
+
+# Import data.table & functions ------------------------------------------------------
+require("data.table")
+source("modules/mod_uporabnost/R/gen.survey.str.R")
+source("modules/mod_uporabnost/R/gen.usability.matrix.R")
+source("modules/mod_uporabnost/R/calc.usability.R")
+
+# Input data ------------------------------------------------------
+params <- commandArgs(trailingOnly = TRUE)
+ID <- params[1]
+
+#get & import dsa: the main survey data file (containing only recnum, status, lurker and all variables relating to answers to survey questions)
+dsa.file <- paste0("modules/mod_uporabnost/temp/data_", ID, ".csv")
+dsa <- fread(dsa.file, header=T, drop=c(1:5, 7, 8))
+
+#get question and item files
+questions.file <- paste0("modules/mod_uporabnost/temp/questions_", ID, ".csv")
+items.file <- paste0("modules/mod_uporabnost/temp/items_", ID, ".csv")
+
+# Main & Output ------------------------------------------------------
+#generate survey structure
+survey.str <- gen.survey.str(colnames(dsa)[-(1)], questions.file, items.file)
+
+if(any(!(is.data.table(survey.str)), nrow(survey.str)==0)){
+ write(survey.str, paste0("modules/mod_uporabnost/results/usability_", ID, ".csv"))
+}else{
+ #delete invisible variables and types: 5, 9, 22, 23, 25
+ survey.str <- survey.str[visible==1 & !(tip %in% c(5, 9, 22, 23, 25)),]
+
+ #generate usability matrix
+ m.all <- gen.usability.matrix(dsa, survey.str)
+
+ if(any(!(is.data.table(m.all)), nrow(m.all)==0)){
+ write(m.all, paste0("modules/mod_uporabnost/results/usability_", ID, ".csv"))
+ }else{
+ #calculate usability indexes
+ m.final <- calc.usability(m.all, 3)
+
+ #write to results
+ write.csv2(m.final, paste0("modules/mod_uporabnost/results/usability_", ID, ".csv"), row.names = FALSE)
+ }
+}
+
+#}
\ No newline at end of file |