[R] Rgui 1.5.1 crashes constantly with the following script
ripley@stats.ox.ac.uk
ripley at stats.ox.ac.uk
Fri Jun 21 20:03:37 CEST 2002
We can do nothing to help you without a reproducible example *and* some
dump information. See the rw-FAQ for how to get a post-mortem dump from
e.g. Dr. Mingw.
On Fri, 21 Jun 2002, Jorge de la Vega wrote:
> I am not sure if something is wrong with my programming or is a bug of chron
> or something else.
> In the following script, db is a large dataframe (dim(db)=c(60698,14)), then
> I select a very small part for a specific date and compute some basic
> statistics. date.base is a chron object
>
> foo<-function(db,date.base){
> date.base<-as.numeric(date.base) #convert to number
> if(dim(base[1])==0)return(c(date.base,rep(0,8)))
> fe.con<-as.numeric(chron(as.character(db$f.con),format="y/m/d")) #make
> chron object and then numeric
> vig<-db[fe.con==f.base,] #subset the database
> if(dim(vig)[1]==0)return(c(date.base,rep(0,8))) #if not records return
> 0 stats
>
> #sample stats
> num.oper<-as.vector(apply(tapply(vig$mnt.base,vig$oper,length),1,c) )
>
> mb.oper<-as.vector(apply(tapply(vig$mnt.base,vig$oper,sum,na.rm=T),1,c))
>
> p.p.pond<-as.vector(unlist(lapply(tapply(vig$mnt.base*vig$plazo,vig$oper,c),
> sum,na.rm=T))/mb.oper)
>
> rm(vig,fe.con) #clean memory
>
> out<-c(date.base,sum(num.oper),num.oper,sum(mb.oper)/1000,mb.oper/1000,plazo
> .prom.pond)
> return(as.vector(out))
> }
>
> The function foo alone works fine
> > foo(db,yesterday)
> [1] 53.0000 21.0000 32.0000 3915.0680 310.0350 3605.0330 176.0825
> 26.4649
>
> But when I include the function in a for,
>
> foo2<-function(db,dates){
> n<-length(dates)
> z<-matrix(0,nrow=n,ncol=9)
> for(i in 1:n)z[i,]<-estad.basicas(db,dates[i])
> return(z)
> }
>
> then I sometimes have the output and sometimes a crash. It doesn´t depend on
> the length of dates, I can run the function with 30 or more fine but then if
> I run it again with only two or three dates it crashes Rgui. Sometimes I
> have a window error from Virtual C++, that I am not sure is part of the
> system.
It isn't.
--
Brian D. Ripley, ripley at 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-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list