Three questions, all involving apparently odd behaviours.
Question 1. The following function uses readline prompts to solicit user
input. Usually it
works fine. But rarely, and only when the function is newly invoked,
the text
associated with the first readline (marked ***) is absent. The user
can still
respond to the invisible prompt, and the input is correctly
interpreted. What
might 'hide' the first readline text on rare occasions?
CatRate_function(){
rm(subce5,moddat,modat,termcol,EXTDAT,MV,AV,TCV,DZV,YV,VEV,mv,av,tcv,dzv,vev
,mainmod)
jobstage_1
while(jobstage!=0){
if(jobstage==1){
stanbox1()
guiDisplayDialog("Function","CRDataSel")
choice_readline("Next/Repeat/Quit. ") ***
if(nchar(choice)==0) choice_"N"
jobstage_switch(choice,n=,N=2,r=,R=1,q=,Q=0,2)
}
if(jobstage==2){
termbox1()
guiDisplayDialog("Function","ModTerms")
choice_readline("Next/Repeat/Back/Quit. ")
if(nchar(choice)==0) choice_"N"
jobstage_switch(choice,n=,N=3,r=,R=2,b=,B=1,q=,Q=0,3)
}
if(jobstage==3){
modgui1()
guiDisplayDialog("Function","FirstLook")
choice_readline("Next/Repeat/Back/Quit. ")
if(nchar(choice)==0) choice_"N"
jobstage_switch(choice,n=,N=4,r=,R=3,b=,B=2,q=,Q=0,4)
}
if(jobstage==4){
predbox1()
guiDisplayDialog("Function","PredictRate")
choice_readline("Repeat/Back/Done. ")
if(nchar(choice)==0) choice_"N"
jobstage_switch(choice,r=,R=4,b=,B=3,0)
}
}
#rm(subce5,moddat,modat,termcol,EXTDAT,MV,AV,TCV,DZV,YV,VEV,mv,av,tcv,dzv,ve
v,mainmod)
}
Question 2. Troubleshooting the functions called by CatRate above. Usually
an error
will abort both the function and the GUI invoking it, which is good.
But
sometimes failure of the function does not abort the calling GUI. In
this
situation I have not found a way to interrupt the processor, other
than
CTRL+ALT+DEL. Esc, closing windows, refreshing memory have no
effect.
Somebody know an escape route for this one?
Question 3. Had to CTRL+ALT+DEL out of S-Plus (error in a function invoked
by a GUI, the GUI
would not relinquish control, my question 2 above).
Started back up, pasted an edited function into the Commands window.
Got "Illegal operation..." where noted.
FirstLook_function() {
.
.
.
if(any(sigint=="VESEXP:DEPZONE"))interaction.plot(modat$VESEXP,modat$DEPZONE
,modat$CPUE,ylab="Mean Raw Catch Rate")
if(any(sigint=="CFV:DEPZONE"))interaction.plot(modat$CFV,modat$DEPZONE,modat
$CPUE,ylab="Mean Raw Catch Rate")
if(any(sigint=="VESEXP:CFV"))interaction.plot(modat$VESEXP,modat$CFV,modat$C
PUE,ylab="Mean Raw Catch Rate")
if(any(sigint=="CFV:VESEXP"))interaction.plot(modat$VESEXP,modat$CFV,modat$C
PUE,ylab="Mean Raw Catch Rate")
EXTDAT<<-summary(mainmod,correlation=F)
MV<<-as.character(sort(unique(modat$MONTH)))
AV<<-as.character(sort(unique(modat$AREA)))
TCV<<-as.character(sort(unique(modat$TONCL)))
DZV<<-as.character(sort(unique(modat$DEPZONE)))
***Illegal operation...
VEV<<-as.character(sort(unique(modat$VESEXP)))
YV<<-as.character(sort(unique(modat$YEAR)))
CFV<<-as.character(sort(unique(modat$CFV)))
xxx_xx[2:length(xx)]
ppp_pp[2:length(pp)]
.
.
.
}
Fixed the problem by simply changing the DZV/VEV line sequence as below.
Does anyone know what the problem might have been, and why the logically
irrelevant change below solved it?
FirstLook_function() {
.
.
.
if(any(sigint=="VESEXP:DEPZONE"))interaction.plot(modat$VESEXP,modat$DEPZONE
,modat$CPUE,ylab="Mean Raw Catch Rate")
if(any(sigint=="CFV:DEPZONE"))interaction.plot(modat$CFV,modat$DEPZONE,modat
$CPUE,ylab="Mean Raw Catch Rate")
if(any(sigint=="VESEXP:CFV"))interaction.plot(modat$VESEXP,modat$CFV,modat$C
PUE,ylab="Mean Raw Catch Rate")
if(any(sigint=="CFV:VESEXP"))interaction.plot(modat$VESEXP,modat$CFV,modat$C
PUE,ylab="Mean Raw Catch Rate")
EXTDAT<<-summary(mainmod,correlation=F)
VEV<<-as.character(sort(unique(modat$VESEXP)))
YV<<-as.character(sort(unique(modat$YEAR)))
CFV<<-as.character(sort(unique(modat$CFV)))
MV<<-as.character(sort(unique(modat$MONTH)))
AV<<-as.character(sort(unique(modat$AREA)))
TCV<<-as.character(sort(unique(modat$TONCL)))
DZV<<-as.character(sort(unique(modat$DEPZONE)))
xxx_xx[2:length(xx)]
ppp_pp[2:length(pp)]
.
.
.
}
Mark Fowler
Marine Fish Division
Bedford Inst Oceanography
P.O. 1006 Halifax NS B2Y 4A2
Email: fowlerm@mar.dfo-mpo.gc.ca
Phone: (902)-426-3529
|