Hi everyone,

 

anybody’s got an idea why the following script doesn’t produce 
batch-histograms?

I’m using Windows XP and R 2.5.1.

 

Here’s the script:

 

matrix<-read.csv("C:\\Stadtwerke_mit_Umlage.csv", header=TRUE,sep=";",dec=".")

Stadtwerke<-colnames(matrix)

Bereich_blau<-66.67

Schleifen<-dim(matrix)[2]

Plan<-c(35.46,1.75,63.49,13.52,39.38,21.83)

Median<-apply(matrix,2,median)

 

breaks<-round((0.01)*dim(matrix[1]))

 

for(i in 1:Schleifen){

  hist(matrix[,i],main=paste("Risiko-Chancenprofil der Stadtwerke ",

  Stadtwerke[i]),col="blue",xlab="EBIT in Mio. €", 
ylab="Häufigkeit",breaks[1])

  abline(v=Median[i],lwd=2,col="grey",lty=3)

  axis(side=1,at=Median[i],labels="Median",col="grey")

  hist_data<-hist(matrix[,i],plot=F,breaks[1])

  Quantil_unten<-quantile(matrix[,i],((100-Bereich_blau)/2)/100)

  Quantil_oben<-quantile(matrix[,i], (100-(100-Bereich_blau)/2)/100)

 

  #Plotten der roten unterer Teil

    for(j in 1:length(hist_data$breaks)){

      if (hist_data$breaks[j]<Quantil_unten)

      hv<-j

    }

  for(k in 1:hv){

          
rect(hist_data$breaks[k],0,hist_data$breaks[k+1],hist_data$counts[k],col="red")

        }

 

    for(l in 1:length(hist_data$breaks)){

      if (hist_data$breaks[l]<Quantil_oben)

      hv2<-l+1

    }

    for(m in hv2:length(hist_data$breaks)){

          
rect(hist_data$breaks[m],0,hist_data$breaks[m+1],hist_data$counts[m],col="red")

        }

  dev.copy(device = postscript,file=paste("C:\\",Stadtwerke[i],".ps"))

  dev.off()

}

 

It seems, that the error is in line „dev.copy“… but I don’t understand 
why. It doesn’t matter if I’m using device = jpeg or postscript. Maybe I 
must add a waiting time of 2 seconds or something like that?

 

Thanks a lot,

Thomas


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to