readCampbell: Reads in Campbell datalogger data

View source: R/readCampbell.R

readCampbellR Documentation

Reads in Campbell datalogger data

Description

Reads a datafile produced by Campbell Scientific dataloggers into a CRHMr data frame. Both old (multiple table, no header) and new (single table, with header) data files can be read in.

Usage

readCampbell(
  campbellFile,
  missingValue = -6999,
  timezone = "",
  quiet = TRUE,
  logfile = ""
)

Arguments

campbellFile

Required. The name of the file containing the Campbell Scientific datalogger output.

missingValue

Optional. Default is -6999. All values less than or equal to this will be set to be NA_real_ .

timezone

Required. The name of the timezone of the data as a character string. This should be the timezone of your data, but omitting daylight savings time. Note that the timezone code is specific to your OS. To avoid problems, you should use a timezone without daylight savings time. Under Linux, you can use CST and MST for Central Standard or Mountain Standard time, respectively. Under Windows or OSX, you can use etc/GMT+6 or etc/GMT+7 for Central Standard and Mountain Standard time. DO NOT use America/Regina as the time zone, as it includes historical changes between standard and daylight savings time.

quiet

Optional. Suppresses display of messages, except for errors. If you are calling this function in an R script, you will usually leave quiet=TRUE (i.e. the default). If you are working interactively, you will probably want to set quiet=FALSE.

logfile

Optional. Name of the file to be used for logging the action. Normally not used.

Value

If unsuccessful, returns FALSE. If successful, returns a CRHMr data frame. If there are two tables in the campbellFile, then they are returned as a list.

Note

If the campbellFile does not contain headers, then the variable names will be assigned by R. In any case, you will probably want to rename the variables using the command names().

Author(s)

Kevin Shook

See Also

readObsFile readExportFile readOutputFile

Examples

## Not run: 
# read in an old format Campbell file
oldformatdata <- readCampbell('OldDataLogger.dat', timezone='MST')
# now extract the data frames from the returned list
obs1 <- oldfomatdata[[1]]
obs2 <- oldformatdata[[2]]
# read in a new format Campbell file
obs3 <- readCampbell('BowHut_Fifteen.dat', timezone='MST')
## End(Not run)

CentreForHydrology/CRHMr documentation built on April 6, 2024, 5:27 p.m.