To use this program, follow these steps:
  1. Open a text editor
  2. COPY the program below and PASTE it into the editor window
  3. Edit the program so that the "PUT-LOCAL-PATH-TO-DATA-FILE-HERE" specification points to where the data file is stored on your system
  4. SELECT ALL and COPY the program then PASTE it into your R console
The program is below this line. If no program is listed, the URL to the EML document may be in error. If the EML file does not include all the information needed, the SAS program will have errors or be incomplete.

# Package ID: knb-lter-vcr.2.3 Cataloging System:VCR.
# Data set title: A study of water quality conditions in the tidal creeks of Northampton County, Vs.
# Data set creator:  Luis Lagera -  
#  Metadata Provider:    - Virginia Coast Reserve Long-Term Ecological Research Project 
#  Contact: Dr Luis Lagera -    - 
#  Contact:    - Information manager - Virginia Coast Reserve Long-Term Ecological Research Project   - jporter@lternet.edu 
# You should replace 'PUT-LOCAL-PATH-TO-DATA-FILE-HERE'  (below) with the appropriate path.   
#   to your data file (e.g., c:\mydata\datafile.txt).                         
infile1  <- file("PUT-LOCAL-PATH-TO-DATA-FILE-HERE", open="r") 

tmp_format <- character()
tmp_format <- c(tmp_format,"A3") 
tmp_format <- c(tmp_format,"2X")
tmp_format <- c(tmp_format,"F2") 
tmp_format <- c(tmp_format,"F2") 
tmp_format <- c(tmp_format,"F2") 
tmp_format <- c(tmp_format,"7X")
tmp_format <- c(tmp_format,"F4") 
tmp_format <- c(tmp_format,"1X")
tmp_format <- c(tmp_format,"F3")  F  
tmp_format <- c(tmp_format,"2X") F  
tmp_format <- c(tmp_format,"2X") F  
tmp_format <- c(tmp_format,"2X") F  
tmp_format <- c(tmp_format,"2X") F  
tmp_format <- c(tmp_format,"2X") F  
tmp_format <- c(tmp_format,"2X") F  
tmp_format <- c(tmp_format,"1X") F  
tmp_format <- c(tmp_format,"2X") F    
 tmp_format        
tmp_cols <- c(
                        "SITEID",   
                        "DAY",   
                        "MONTH",   
                        "YEAR",   
                        "TIME",   
                        "JUCDAY",   
                        "BATVOL",   
                        "PANTEMP",   
                        "THCOTEM",   
                        "HYDTEMP",   
                        "HYDPH",   
                        "HYDCOND",   
                        "HYDSAL",   
                        "HYDSAT",   
                        "HYDDO")
# This creates a data.frame named:  dataTable1     
    dataTable1 <-read.fortran(infile1,tmp_format, col.names=tmp_cols, check.names=TRUE,na.strings=c("NA","."))
rm(tmp_format, tmp_cols)
    
               

 
tmp_var <- character()
tmp_label <- character()
                       tmp_var <- c(tmp_var , "SITEID") 
                       tmp_label <- c(tmp_label , "Site Name / Code- ")
                       tmp_var <- c(tmp_var , "DAY") 
                       tmp_label <- c(tmp_label , "Day- DD")
                       tmp_var <- c(tmp_var , "MONTH") 
                       tmp_label <- c(tmp_label , "Month- MM")
                       tmp_var <- c(tmp_var , "YEAR") 
                       tmp_label <- c(tmp_label , "Year- YY")
                       tmp_var <- c(tmp_var , "TIME") 
                       tmp_label <- c(tmp_label , "Time- none")
                       tmp_var <- c(tmp_var , "JUCDAY") 
                       tmp_label <- c(tmp_label , "Julian Day- none")
                       tmp_var <- c(tmp_var , "BATVOL") 
                       tmp_label <- c(tmp_label , "Battery Voltage- volts")
                       tmp_var <- c(tmp_var , "PANTEMP") 
                       tmp_label <- c(tmp_label , "Panel Temperature- deg C")
                       tmp_var <- c(tmp_var , "THCOTEM") 
                       tmp_label <- c(tmp_label , "Thermocouple Temperature (Air / Water)- deg C")
                       tmp_var <- c(tmp_var , "HYDTEMP") 
                       tmp_label <- c(tmp_label , "Water Temperature- deg C")
                       tmp_var <- c(tmp_var , "HYDPH") 
                       tmp_label <- c(tmp_label , "pH- pH units")
                       tmp_var <- c(tmp_var , "HYDCOND") 
                       tmp_label <- c(tmp_label , "Conductivity- uSIEMES/cm")
                       tmp_var <- c(tmp_var , "HYDSAL") 
                       tmp_label <- c(tmp_label , "Salinity- %")
                       tmp_var <- c(tmp_var , "HYDSAT") 
                       tmp_label <- c(tmp_label , "Dissolved oxygen content as pement saturation- %")
                       tmp_var <- c(tmp_var , "HYDDO") 
                       tmp_label <- c(tmp_label , "Dissolved oxygen- mg/l")
labelFrame1<-data.frame(variable=tmp_var, label=tmp_label)
rm(tmp_var, tmp_label)        
 

tmp_var <- character()
tmp_code <- character()                
tmp_label <- character() 
codeLabelFrame1 <- data.frame(variable=tmp_var, code=tmp_code, label=tmp_label) 
rm(tmp_var, tmp_label, tmp_code) 
                
# HERE IS A LIST  OF VARIABLES from  dataTable1  AND LABELS FOR THOSE VARIABLES
labelFrame1   
                
 # HERE IS A LIST OF VARIABLES TO WHICH CODES HAD BEEN ASSIGNED               
codeLabelFrame1           
                
attach(dataTable1)               
# The analyses below are basic descriptions of the variables. After testing, they should be replaced.                 
        
                 
summary(as.factor(SITEID))  
summary(as.numeric(DAY))  
summary(as.numeric(MONTH))  
summary(as.numeric(YEAR))  
summary(as.numeric(TIME))  
summary(as.numeric(JUCDAY))  
summary(as.numeric(BATVOL))  
summary(as.numeric(PANTEMP))  
summary(as.numeric(THCOTEM))  
summary(as.numeric(HYDTEMP))  
summary(as.numeric(HYDPH))  
summary(as.numeric(HYDCOND))  
summary(as.numeric(HYDSAL))  
summary(as.numeric(HYDSAT))  
summary(as.numeric(HYDDO))