hohenTp<- read.table("C:/CLIM/HohenT.txt",header=T) ### attach(hohenTp) Y<- Tyear/100; "annual temperature means in Celsius" N<- length(Y); meanY<- mean(Y); sdY<- sqrt(var(Y)) rhoY<- cor(Y[1:(N-1)],Y[2:N]) c("N Years"=N, "Mean"=meanY, "StDev"=sdY, "Autocor(1)"=rhoY) #------------------------------------------------------------- printL<- function(Y){ N<- length(Y); meanY<- mean(Y); sdY<- sqrt(var(Y)) rhoY<- cor(Y[1:(N-1)],Y[2:N]) #as last command of the function printL: c("N Years"=N, "Mean"=meanY, "StDev"=sdY, "Autocor(1)"=rhoY) } Y<- Tyear/100; "annual temperature means in Celsius" printL(Y) Y<- (dcly+jan+feb)/30; "winter temperature means in Celsius" #Alternatively: #Y<- 1:N; Y[1]<- (mean(dec[1:10])+jan[1]+feb[1])/30 #Y[2:N]<- (dec[1:(N-1)]+jan[2:N]+feb[2:N])/30 printL(Y) Y<- (jun+jul+aug)/30; "summer temperature means in Celsius" printL(Y) detach(hohenTp) ### rm(list=objects()) #remove all objects from workspace ###