Imports data from a user-supplied file, and converts it to a Sample data frame (including summing multiple constituents), appropriate for EGRET analysis. First column is date, second is remark code, and third is value. If multiple constituents are to be combined with interval censoring, additional pairs of columns can be inserted, each pair starting with remark code (specifically looking for <), followed by the values. If the date format is not automatically detected, the format can be specified using the "format" argument.
readUserSample(filePath, fileName, hasHeader = TRUE, separator = ",",
verbose = TRUE, format = "%m/%d/%Y")
A data frame 'Sample' with the following columns:
Name | Type | Description |
Date | Date | Date |
ConcLow | numeric | Lower limit of concentration |
ConcHigh | numeric | Upper limit of concentration |
Uncen | integer | Uncensored data (1=TRUE, 0=FALSE) |
ConcAve | numeric | Average concentration |
Julian | integer | Number of days since Jan. 1, 1850 |
Month | integer | Month of the year [1-12] |
Day | integer | Day of the year [1-366] |
DecYear | numeric | Decimal year |
MonthSeq | integer | Number of months since January 1, 1850 |
SinDY | numeric | Sine of the DecYear |
CosDY | numeric | Cosine of the DecYear |
character specifying the path to the file. If it is in the working directory, use ".".
character name of file to open
logical true if the first row of data is the column headers
character character that separates data cells. , default is "," which is separator used in a .csv file.
logical specifying whether or not to display progress message
character indicating the format of the date (which should
be in the first column). Default is "%m\/%d/%Y". See ?strptime
for options. The code will initially look for R's standard YYYY-MM-DD, and
check this format as a backup.
compressData
, populateSampleColumns
filePath <- system.file("extdata", package="EGRET")
fileName <- 'ChoptankRiverNitrate.csv'
Sample <- readUserSample(filePath,fileName, separator=";",verbose=FALSE)
Run the code above in your browser using DataLab