From dtrenkler@nts6.oec.uni-osnabrueck.de  Tue Mar  7 11:06:34 2000
From: dtrenkler@nts6.oec.uni-osnabrueck.de (Trenkler, Dietrich)
Date: Tue, 7 Mar 2000 12:06:34 +0100
Subject: AW: [Rd] R-crash using cut-and-paste (PR#472)
Message-ID: <51615E1449A4D111AE9900008322A88025CD10@nts6.oec.Uni-Osnabrueck.DE>



> -----Ursprngliche Nachricht-----
> Von:	Prof Brian D Ripley 
> Gesendet am:	Tuesday, March 07, 2000 11:30 AM
> An:	dtrenkler@nts6.oec.uni-osnabrueck.de
> Cc:	r-devel@stat.math.ethz.ch; R-bugs@biostat.ku.dk
> Betreff:	Re: [Rd] R-crash using cut-and-paste (PR#472)
> 
> On Tue, 7 Mar 2000 dtrenkler@nts6.oec.uni-osnabrueck.de wrote:
> 
> > Dear R-Team,
> > 
> > sorry for bugging (:-)), it's me again. In the FAQ coming along with
> the
> > R distribution it reads:
> > 
> > If R executes an illegal instruction, or dies with an operating
> system
> > error message that indicates a problem in the program (as opposed to
> > something like "disk full"), then it is certainly a bug.
> > 
> > This encourages me to describe a crash I encountered a few minutes
> ago.
> > 
> > I had written a function in an  editor, copied it to the clip-board
> and
> > tried to establish it in my workspace (cut and paste). Suddenly I
> got
> > the following message form Windows NT (sorry it's german):
> 
> [...]
> 
> How big was the function you were trying to paste in?  
	[Dietrich Trenkler]  About 36 lines. Here you are:

	
tefo_function(form,symb="%",dir="F:/DIDITEX/compstatr/ss00/r2latex/"){
	tf_paste(c(dir,form,".r2l"),collapse="")
	cat(c("Reading ",tf,".\n"),collapse="")
	ss_scan(file=tf,what="",sep="\n",quiet=TRUE)
	sss_ss
	a_(1:length(sss))[ss==as.vector("\\end{RFunction}")]
	sss_sss[1:a-1]
	b_(1:length(sss))[ss==as.vector("\\begin{RFunction}")]

	collect.expressions_function(ss){
	ss_ss[grep("%",ss)]
	ss_paste(ss,collapse="")
	ss_substring(ss,1:nchar(ss),1:nchar(ss))
	ss_as.vector(ss[!((ss=="%")|(ss==" "))])
	ss_paste(c("list(",ss[-1],")"),collapse="")
	ss
	}
	a_collect.expressions(ss[-(1:a)])
	a_paste(c("a0_",a),collapse="")
	sss_c(sss[-(1:b)],a)
	sss_c(sss,"a0_lapply(a0,signif,digits=digits)")
	a_paste(c("ss_paste(c('",tf,,"'),collapse='')"),collapse="")
	sss_c(sss,a)
	sss_c(sss,"ss_scan(file=ss,what='',sep='\\n',quiet=TRUE)")
	
sss_c(sss,"a_(1:length(ss))[ss==as.vector('\\\\end{RFunction}')]")
	sss_c(sss,"ss_ss[-(1:a)]")
	sss_c(sss,"ss_ss[-grep('%',ss)]")
	sss_c(sss,"ss_paste(ss,collapse='\\n',sep='\\n')")
	sss_c(sss,paste("for(i in
1:length(a0)){ss_sub('",symb,"',as.character(a0),ss);a0_a0[-1]}",sep="")
)
	sss_c(sss,"if(!file=='')")
	
sss_c(sss,"write(paste(ss,collapse='\\n',sep='\\n'),file=paste(c(dir,fil
e,'.tex'),collapse=''))")
	sss_c(sss,"else return(cat(ss,'\\n'))")
	sss_c(sss,"}")
	
eval(parse(text=paste(sss,collapse="\n",sep="\n")),envir=.GlobalEnv)
	cat("Function ",form," established.\n")
	}
	 


> There are 
> distinct limits to such cut-and-paste, not all of which are under 
> our control. 
	[Dietrich Trenkler]  This seems to be true. When I copied this
function to the clipboard R crashed several times (sometimes without any
messages). There seems to be some interferences with the clipboard...


> As a general work-around, you will find it much easier to use source()
> to
> load in sizeable functions than cut-and-paste.
	[Dietrich Trenkler]  Henceforth I will obey to your advice.


> -- 
> Brian D. Ripley,                  ripley@stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


AW: [Rd] R-crash using cut-and-paste (PR#472)
Trenkler, Dietrich