# NOT RUN {
# First we must access our climatic database through RODBC, wich requires to
# have this package installed. System programs that allow ODBC connections to
# databases must also be installed and properly configured.
#
# For this example we will assume that our database is named "climate" and we
# access it with user "USER" and password "PASS". Then we open the connection
# with:
#
library(RODBC)
ch <- odbcConnect("climate",uid="USER",pwd="PASS")
#
# Now we want to use this function to gather all monthly relative humidity
# averages for the period 1961-2015, requiring a minimum of 10 years of data
# (not necessarily consecutive). We must use the corresponding names of tables
# and headers existing the the database, and putting the parameters in the
# required order we avoid the need to name them:
#
db2dat('HRel',1961,2015,10,FALSE,ch,'<!-- %Y-%m-%d','monthly_relhum', -->
'Station','Date','Value','stations','Station','Name','Longitude',
'Latitude','Elevation')
#
odbcClose(ch) #close the connection if you do not need it anymore
#
# Our data would now be ready to be homogenized with the homogen function:
#
homogen('HRel',1961,2015,vmin=0,vmax=100)
#
# }
Run the code above in your browser using DataLab