Any advices/ideas are greatly appreciated!
Best wishes
HJ
Below is my code...
=====================
SumTab<-function(Data=SortedDataInList,StartDate="30/1/12",EndDate="31/05/12",StartTime="22:50:00",EndTime="23:00:00"){
Start= chron(StartDate,StartTime , format=c(dates="d/m/y", times="h:m:s"))
End= chron(EndDate,EndTime , format=c(dates="d/m/y", times="h:m:s"))
deltat<- times("00:10:00")
TT<- seq(Start,End, by = times("00:10:00"))
TT1 = substr(TT, 2, 18)
Data1=Data
for (i in 1:length(Data1)){
SumTab1[[i]]= matrix(NA, nrow=5, ncol=ncol(SortedDataInList[[i]])-4)
SortedDataInList1[[i]]= matrix(NA, nrow=length(TT1),
ncol=ncol(Data1[[i]]))
SortedDataInList1[[i]]=Data1[[i]][match(as.character(TT1),as.character(Data1[[i]][,1])),]
SumTab1[[i]][1,]<-apply(SortedDataInList1[[i]][,4:16],2,min)
SumTab1[[i]][2,]<-apply(SortedDataInList1[[i]][,4:16],2,mean)
SumTab1[[i]][3,]<-apply(SortedDataInList1[[i]][,4:16],2,median)
SumTab1[[i]][4,]<-apply(SortedDataInList1[[i]][,4:16],2,sd)
SumTab1[[i]][5,]<-apply(SortedDataInList1[[i]][,4:16],2,max)
colnames(SumTab1[[i]])=c("vOL1","VOL2","VOL3","CUR1","CUR2","CUR3","THD1","THD2","THD3","RPD","RPR","RAPD","RAPR")
rownames(SumTab1[[i]])=c("Min","Mean","Standard
Deviation","Median","Max")
SumLax[[i]]<-xtable(SumTab1[[i]],label=as.character(StationsInDir[i]),caption=as.character(StationsInDir[i]))
par(mfrow=c(4,4),oma=c(4,0,2,0))
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,4],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Voltage
1 (v)",xlab="Date/Time ind.(10 min. int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,5],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Voltage
2 (v)",xlab="Date/Time ind.(10 min. int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,6],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Voltage
3 (v)",xlab="Date/Time ind.(10 min. int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,7],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Current
1 (A)",xlab="Date/Time ind.(10 min. int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,8],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Current
2 (A)",xlab="Date/Time ind.(10 min. int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,9],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Current
3 (A)",xlab="Date/Time ind.(10 min. int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,10],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Total
harmonic distortion 1 (%)",xlab="Date/Time ind.(10 min.
int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,11],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Total
harmonic distortion 2 (%)",xlab="Date/Time ind.(10 min.
int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,12],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Total
harmonic distortion 3 (%)",xlab="Date/Time ind.(10 min.
int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,13],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Real
power delivered (mw)",xlab="Date/Time ind.(10 min.
int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,14],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Real
power received (mw)",xlab="Date/Time ind.(10 min. int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,15],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Reactive
power delivered (MVAr)",xlab="Date/Time ind.(10 min.
int.)",type="p",cex=.001)
plot(1:length(SortedDataInList1[[i]][,1]),SortedDataInList1[[i]][,16],xlim=c(1,length(SortedDataInList1[[i]][,1])),ylab="Reactive
power received (MVAr)",xlab="Date/Time ind.(10 min.
int.)",type="p",cex=.001)
title(main=StationsInDir[i],outer=TRUE,cex.main=2.0)
mtext(side=1,Start, outer = TRUE, line=0,cex = 0.6)
mtext(side=1,End, outer = TRUE, line=2,cex = 0.6)
#pdf(paste(as.character(StationsInDir[i]),".pdf"))
dev.copy(pdf,file=paste(as.character(StationsInDir[i]),".pdf"))
dev.off()
}
}
[[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.