Add troubleshooting hints via errText[[...]]

This commit is contained in:
hyginn 2021-10-04 22:53:06 +02:00
parent 2e65e18f22
commit 9603fbede8
2 changed files with 49 additions and 12 deletions

View File

@ -91,4 +91,39 @@ if (default.stringsAsFactors()) {
cat("\n") cat("\n")
} }
errText <- list()
errText[["noProfileFile"]] <- '
Your PROFILE FILE does not exist. This problem must be fixed to continue.
The code expects the file "./myScripts/.myProfile.R" to exist and to
contain your correct eMail address and student number. Detailed
instructions were given when you first ran the init() command.
Try running init() again and follow the instructions. Reload youR RStudio
session and start over with this file.
If this does not fix the problem, ask for help.
'
errText[["noStudentNumber"]] <- '
Your STUDENT NUMBER has not been defined. This problem must be fixed to continue.
The code expects the file "./myScripts/.myProfile.R" to exist and to
contain your correct eMail address and student number. This file gets
sourced when you start a new R-session, but since you see this error
message there was a problem.
Perhaps you need to restart your R-session. Try closing the RStudio
project and reopening it from the File > Recent Projects menu.
Perhaps there was a syntax error in your file. Then not all the
instructions in the file are executed. Check the file: is your
email perhpas not defined? Or did you type it without qwuoataion
marks?
Try fixing problems, and then restart R as described above.
If none of this fixes the problem, ask for help.
'
# [END] # [END]

View File

@ -4,11 +4,12 @@
# R code accompanying the BIN-MYSPE unit # R code accompanying the BIN-MYSPE unit
# #
# #
# Version: 1.3 # Version: 1.4
# #
# Date: 2017-09 - 2021-09 # Date: 2017-09 - 2021-10
# Author: Boris Steipe (boris.steipe@utoronto.ca) # Author: Boris Steipe (boris.steipe@utoronto.ca)
# #
# V 1.4 Add troubleshooting hints via errText[[...]]
# V 1.3 2021 update of MYSPE mechanics; fix a bug no one had complained about # V 1.3 2021 update of MYSPE mechanics; fix a bug no one had complained about
# V 1.2 Reorganized proportional plot section into a "further reading" # V 1.2 Reorganized proportional plot section into a "further reading"
# section, added nested-box, and sankey plot visualization of # section, added nested-box, and sankey plot visualization of
@ -36,14 +37,14 @@
#TOC> #TOC>
#TOC> Section Title Line #TOC> Section Title Line
#TOC> ----------------------------------------------------------------- #TOC> -----------------------------------------------------------------
#TOC> 1 PREPARATIONS 51 #TOC> 1 PREPARATIONS 52
#TOC> 2 SUITABLE MYSPE SPECIES 63 #TOC> 2 SUITABLE MYSPE SPECIES 65
#TOC> 3 ADOPT "MYSPE" 87 #TOC> 3 ADOPT "MYSPE" 89
#TOC> 4 FURTHER READING: PLOTTING PROPORTIONS 126 #TOC> 4 FURTHER READING: PLOTTING PROPORTIONS 128
#TOC> 4.1 Percentages 144 #TOC> 4.1 Percentages 146
#TOC> 4.2 Visualizing proportions: Pie chart 163 #TOC> 4.2 Visualizing proportions: Pie chart 165
#TOC> 4.3 Visualizing proportions: Nested squares 241 #TOC> 4.3 Visualizing proportions: Nested squares 243
#TOC> 4.4 Visualizing proportions: Sankey diagrams 278 #TOC> 4.4 Visualizing proportions: Sankey diagrams 280
#TOC> #TOC>
#TOC> ========================================================================== #TOC> ==========================================================================
@ -53,10 +54,11 @@
# Execute the two conditionals below: # Execute the two conditionals below:
if (! file.exists("./myScripts/.myProfile.R")) { if (! file.exists("./myScripts/.myProfile.R")) {
stop("PANIC: profile file does not exist. Fix problem or ask for help.") stop(errText[["noProfileFile"]]) # message defined in .Rprofile
} }
if (! exists("myStudentNumber")) { if (! exists("myStudentNumber")) {
stop("PANIC: profile data wasn't loaded. Fix problem or ask for help.") stop(errText[["noStudentNumber"]]) # message defined in .Rprofile
} }