Rev. | fffd6ca9340836d53e61c03ea733dfa2c77c9584 |
---|---|
大小 | 958 字节 |
时间 | 2007-01-26 08:18:34 |
作者 | iselllo |
Log Message | I corrected a small bug in the code R-codes/read_two_sets.R (before
|
rm(list=ls())
lendat<-4
for(i in 1:lendat)
{
fn <- paste("temp",i-1,".txt",sep="")
dat <- read.table(fn,header=TRUE,nrow=20000)
# ... do your stuff on "dat" here ...
dat_temp<-as.matrix(dat)
{
if (i ==1) {mymat<-dat_temp}
else
mymat<-cbind(mymat,dat_temp)
}
}
rm(dat)
for(i in 1:lendat)
{
fn <- paste("Ttemp",i-1,".txt",sep="")
dat <- read.table(fn,header=TRUE,nrow=20000)
# ... do your stuff on "dat" here ...
dat_temp<-as.matrix(dat)
{
if (i ==1) {mymat2<-dat_temp}
else
mymat2<-cbind(mymat2,dat_temp)
}
}
# now I generate the needed plots to carry out the comparison
for(i in 1:lendat)
{
fn <- paste("temp",i-1,".pdf",sep="")
pdf(fn)
plot(mymat[ ,(2*i-1)],mymat[ ,2*i],"l",lwd=1,col="blue",ylab=expression("Temperature"),xlab=expression("distance from the axis"),ylim=range(c(min(mymat[ ,2*i],mymat2[ ,2*i]),(max(mymat[ ,2*i],mymat2[ ,2*i])))))
lines(mymat2[ ,(2*i-1)],mymat2[ ,2*i],lwd=1,col="red")
dev.off()
}
print("So far so good")