Fix PrepGR when the dataset is format as a tibble object
The PrepGR()
function does not work when the dataset given to the ObsDF
argument is a tibble
object.
The problem is the same using the ShinyGR()
function.
The problem is caused by the fact that an extraction of a unique column from a data.frame
returned a vector
, but a an extraction of a unique column from a tbl
returned a data.frame
.
Then, a single-column data.frame
given as an argument to the data.frame
function keeps the original column name and does not take the new name given in the new data.frame
.
Original code:
ObsDF <- data.frame(DatesR = ObsDF[, 1L],
Precip = ObsDF[, 2L],
PotEvap = ObsDF[, 3L],
Qobs = ObsDF[, 4L],
TempMean = TempMean)
Solution :
ObsDF <- data.frame(DatesR = ObsDF[, 1L, drop = TRUE],
Precip = ObsDF[, 2L, drop = TRUE],
PotEvap = ObsDF[, 3L, drop = TRUE],
Qobs = ObsDF[, 4L, drop = TRUE],
TempMean = TempMean)