Vectorize rH.to.VPD

Issue #1 resolved
Former user created an issue

There is an if statement in the rH.to.VPD function that is not vetorized :

rH.to.VPD <- function(rH,Tair){
  if(rH > 1){
    warning("relative humidity (rH) has to be between 0 and 1.")
  }
  ...

It could be nice to vectorize it using any() for people using the function in other context :

rH.to.VPD <- function(rH,Tair){
  if(any(rH > 1)){
    warning("relative humidity (rH) has to be between 0 and 1.")
  }
  ...

Comments (5)

  1. Juergen Knauer repo owner

    Thanks! I have just submitted the corrected version. Will be on CRAN with the next package update.

  2. Juergen Knauer repo owner

    I have changed this to:

      if(any(rH > 1 & !is.na(rH))){
        warning("relative humidity (rH) has to be between 0 and 1.")
      }
    

    otherwise it will give an error if there are NAs

  3. Log in to comment