Skip to content
Prev 139820 / 398525 Next

Error when producing multiple graphes

bartjoosen schrieb:
Of course. Here is the relevant part of the code I'm working with. I suppose it will be helpful for you to have the csv file, as well. But as an attachment will be deleted, I will send it to you upon request.


****

rm(list=ls(all.names=TRUE))

agr1<-read.csv2("sales.csv")

attach(agr1)

# Select variables:

type3m<-data.frame(cornmethod,maizemethod,paddymethod,ricemethod,rapemethod,ograinmethod,vegmethod,
fruitmethod,ocropmethod,pigmethod,cowmethod,poultrymethod,eggmethod,oanimalmethod,forestrymethod,fisherymethod,
rentmethod,processmethod,othermethod)

type3l<-data.frame(cornloc,maizeloc,paddyloc,riceloc,rapeloc,ograinloc,vegloc,fruitloc,ocroploc,pigloc,
cowloc,poultryloc,eggloc,oanimalloc,forestryloc,fisheryloc,rentloc,processloc,otherloc)

#Define legends for bars

barnamesm<-c("1=Village fair","2=State quota", "3=Trader", "4=Other")
barnamesloc<-c("1=nat. vill.","2=admin. 
vill.","3=township","4=county","5=province","6=outside prov.")

#Print barplots into ps file
postscript("salemethods.ps", horizontal=TRUE)

for(xn in names(type3m)) barplot(table(type3m[[xn]]), main = paste 
("Barplot of", xn), width=0.75,legend.text=barnamesm, 
xlim=c(0,4),ylim=c(0,400))

dev.off()

#Print barplots into ps file
postscript("salelocations.ps", horizontal=FALSE)

for(xn in names(type3l)) barplot(table(type3l[[xn]]), main = 
paste("Barplot of", xn),legend.text=barnamesloc,xlim=c(0,6))

dev.off()

detach(agr1)