View source: R/sndet_read_data_metadata.R View source: R/fhs_read_data_metadata.R View source: R/esqc_Read_data_metadata.R
fun_read_metadata | R Documentation |
fun_read_metadata(PATH, FILE)
PATH |
|
FILE |
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (PATH, FILE)
{
data = read.csv(paste(PATH, FILE, sep = ""), stringsAsFactors = F)
units = data[c(1, 2), ]
data = data[-c(1, 2), ]
if (colnames(data)[ncol(data)] == "Precip_T_Int15_Metadata") {
METADATA = T
}
else {
METADATA = F
warning("This file doesn't contain 'Precip_T_Int15_Metadata'. No 'Precip_T_Int15_Metadata' available!")
warning("Function: read_metadata has not assigned any new variable! Be careful!")
}
if (METADATA == T) {
year <- substring(data[, 1], 1, 4)
month <- substring(data[, 1], 6, 7)
day <- substring(data[, 1], 9, 10)
hour <- substring(data[, 1], 12, 13)
min <- substr(data[, 1], 15, 16)
date_chr <- paste(year, "-", month, "-", day, " ", hour,
":", min, ":00", sep = "")
time <- as.POSIXct(strptime(x = date_chr, format = "%Y-%m-%d %H:%M:%S"),
tz = "Etc/GMT-1")
zoo_metadata = zoo(data[, ncol(data)], order.by = time)
}
return(zoo_metadata)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.