karlsTp<- read.table("C:/CLIM/KarlsT.txt",header=T) ### attach(karlsTp) postscript(file="C:/CLIM/KarlsT12.ps",height=6,width=20,horiz=F) sink("C:/CLIM/Tempout.txt") #Output on file Tempout.txt quot<- "Karlsruhe, Temperature 1799-2008"; quot Y<- Tyear/100; "annual means in Celsius" cylim<- c(8.0,12.5); cabl<- c(8:12) plot(Year,Y,type="l",lty=1,xlim=c(1790,2008),ylim=cylim, xlab="Year",ylab="Temperature [C]",cex=1.3) title(main=quot) abline(h=cabl,lty=3); abline(h=mean(Y),lty=4) text(2008,mean(Y),round(mean(Y),3),cex=0.8) #total mean #--------------------------------------------------------------- tempger<- function(Year,Y,A,B){ #compute and plot straight line Y0<- Y[A:B]; Year0<- Year[A:B]-1800 #to have smaller numbers tpger0<- lm(Y0~Year0); tpg0<- summary(tpger0) lines(Year0+1800,predict(tpger0),lty=1) #plot fitted line return(tpg0) } "19th century" Jbeg<- 2; A1<- Jbeg+1; B1<- Jbeg+100; tpg1<- tempger(Year,Y,A1,B1); tpg1 #print summary "20th century" A2<- Jbeg+101; B2<- Jbeg+200; tpg2<- tempger(Year,Y,A2,B2); tpg2 #print summary dev.off() detach(karlsTp) ### rm(list=objects()) ###