Skip to content

db_insert_results_ts issue (variables list) #57

@FloodHydrology

Description

@FloodHydrology

It appears there is an issue with the variables list functionality in the db_insert_results_ts function. Below is sample code (from the documentation!)

db <- rodm2::create_sqlite(connect = TRUE)

tsrv <-data.frame(
 Timestamp = c("2018-06-27 13:45:00", "2018-06-27 13:55:00"),
"wd" = c(180,170),
 "ws" = c(1, 1.5),
 "gustspeed" = c(2, 2.5))

db_insert_results_ts(
 db = db,
 datavalues = tsrv,
 methodcode = "SonicAnemometer",
 site_code = "BB2",
 variables = list("Wind direction" = list("wd", "Degree")),
 sampledmedium = "air")

This resulted in the following error:
Error: Parameter 3 does not have length 1.

I tried to track the error through the function, and it appears it is coming from this line [within the function]:

        RSQLite::dbBind(sql, params = list(variabletypecv = "Unknown", 
                                       variablecode = newvar, 
                                       variablenamecv = variables[[newvar]][["name"]], 
                                       nodatavalue = "-9999"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions