Commit 0db3ca8a authored by jml's avatar jml
Browse files

fix when row == 0

parent 666bbfa1
Package: frostlyr
Type: Package
Version: 0.0.6
Version: 0.0.7
Authors@R: c(person("Jean-Marie", "Lepioufle", , "jml@nilu.no", role=c("aut","cre")),
person("NILU",role="cph"))
Title: frostlyr
......
......@@ -11,13 +11,16 @@
#' }
frostlyr_df_data <- function(x,res){
if (nrow(res)>0){
tmp <- friendlyts::ts_spread(df=res, col_date=c("date"),
col_key=c("CO_NAME","ID","levelValue"),col_target="value",
precision=x$timeObj$precision(),tzone=x$timeObj$tzone(),
date_type="%Y-%m-%dT%H:%M:%OSZ")
tmp <- friendlyts::ts_spread(df=res, col_date=c("date"),
col_key=c("CO_NAME","ID","levelValue"),col_target="value",
precision=x$timeObj$precision(),tzone=x$timeObj$tzone(),
date_type="%Y-%m-%dT%H:%M:%OSZ")
df <- friendlyts::check_date(tbl_fts=tmp, fromDate=x$timeObj$fromDateTime(),toDate=x$timeObj$toDateTime(),timeResolution=x$timeObj$timeResolution(), v=x$timeObj$v(), precision=x$timeObj$precision(), tzone=x$timeObj$tzone(),missingValues=NA,date_type="posixlt")
df <- friendlyts::check_date(tbl_fts=tmp, fromDate=x$timeObj$fromDateTime(),toDate=x$timeObj$toDateTime(),timeResolution=x$timeObj$timeResolution(), v=x$timeObj$v(), precision=x$timeObj$precision(), tzone=x$timeObj$tzone(),missingValues=NA,date_type="posixlt")
} else {
df <- friendlyts::friendlyts(varnames="empty",date_type=c("posixlt"),fromDate=x$timeObj$fromDateTime(),toDate=x$timeObj$toDateTime(),timeResolution=x$timeObj$timeResolution(),v=x$timeObj$v(),precision=x$timeObj$precision(),tzone=x$timeObj$tzone())
}
if (x$dateStructObj$COL_DATE) {
stop("to be done")
......@@ -38,12 +41,19 @@ frostlyr_df_data <- function(x,res){
#' }
frostlyr_df_qa <- function(x,res){
tmp <- friendlyts::ts_spread(df=res, col_date=c("date"),
col_key=c("CO_NAME","ID","levelValue"),col_target="qualityCode",
precision=x$timeObj$precision(),tzone=x$timeObj$tzone(),
date_type="%Y-%m-%dT%H:%M:%OSZ")
if (nrow(df)>0){
tmp <- friendlyts::ts_spread(df=res, col_date=c("date"),
col_key=c("CO_NAME","ID","levelValue"),col_target="qualityCode",
precision=x$timeObj$precision(),tzone=x$timeObj$tzone(),
date_type="%Y-%m-%dT%H:%M:%OSZ")
df <- friendlyts::check_date(tbl_fts=tmp, fromDate=x$timeObj$fromDateTime(),toDate=x$timeObj$toDateTime(),timeResolution=x$timeObj$timeResolution(), v=x$timeObj$v(), precision=x$timeObj$precision(), tzone=x$timeObj$tzone(),missingValues=NA,date_type="posixlt")
} else {
df <- friendlyts::friendlyts(varnames="empty",date_type=c("posixlt"),fromDate=x$timeObj$fromDateTime(),toDate=x$timeObj$toDateTime(),timeResolution=x$timeObj$timeResolution(),v=x$timeObj$v(),precision=x$timeObj$precision(),tzone=x$timeObj$tzone())
}
df <- friendlyts::check_date(tbl_fts=tmp, fromDate=x$timeObj$fromDateTime(),toDate=x$timeObj$toDateTime(),timeResolution=x$timeObj$timeResolution(), v=x$timeObj$v(), precision=x$timeObj$precision(), tzone=x$timeObj$tzone(),missingValues=NA,date_type="posixlt")
icol <- friendlyts::get_date_col(precision=x$timeObj$precision())
names(df) <- c(names(df)[icol],paste0("qa_",names(tmp)[-c(icol)]))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment