Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • airGRteaching airGRteaching
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 10
    • Issues 10
    • List
    • Boards
    • Service Desk
    • Milestones
  • Redmine
    • Redmine
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • HYCAR-Hydro
  • airGRteachingairGRteaching
  • Issues
  • #49

Closed
Open
Created Oct 13, 2021 by Delaigue Olivier@olivier.delaigueOwner

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)
Edited Oct 13, 2021 by Delaigue Olivier
Assignee
Assign to
Time tracking