Skip to content

Commit

Permalink
Urgency score now calculated and reported when sim_urgency() passed a…
Browse files Browse the repository at this point in the history
…n urgency value too
  • Loading branch information
jhollway committed Aug 23, 2024
1 parent 24faa39 commit 5666a6a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/sim_urgency.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ sim_urgency <- function(urgency,
combins <- merge(combins, time, by.x = "Var3", by.y = "word")
combins <- combins[,c("Var1","Var2","Var3","Rescaled.x","Rescaled.y","Rescaled")]
combins$combo <- as.numeric(combins$Rescaled.x) * combins$Rescaled.y * as.numeric(combins$Rescaled)
formul <- combins[which.min.diff(abs(urgency), combins$combo),c("Var1","Var2","Var3")]
selectd <- which.min.diff(abs(urgency), combins$combo)
formul <- combins[selectd,c("Var1","Var2","Var3")]
if(urgency < 0) intcom <- c(formul[1:2], sample(c("not","never"),1)) else
intcom <- formul[1:2]
out <- paste(pronoun, paste(intcom, collapse = " "), "do this", formul[3])
cat("Urgency score: ",
combins[selectd,"Rescaled.x"] * combins[selectd,"Rescaled.y"] * combins[selectd,"Rescaled"],
"\n", sep = "")
} else {

if(!missing(commitment)){
commit <- comm$word[which.min.diff(abs(commitment), comm$Rescaled)]
if(commitment<0) commit <- paste(commit, sample(c("not","never"),1))
Expand Down

0 comments on commit 5666a6a

Please sign in to comment.