Unbiased RMSE ubrmse

I am writing simple function in R to calculate the unbiased RMSE (ubrmse) given a set of observed and expected values. The function I have so far is as follows:

ubRMSE <- function(obs, exp) {
  #Combine the observed and expected data into data frame
  newDf <- cbind.data.frame(obs, exp)
  #Remove any rows containing NA values
  newDf <- newDf[complete.cases(newDf), ]
  #Calculate r
  r <- as.data.frame(gof(sim = newDf[,2], obs = newDf[,1], digit = 4))
  r <- r[16,1]
  #Calculate ubRMSE
  ubRMSEStat <- sqrt(var(newDf[,2]) + var(newDf[,1]) - 2 * r * 
  var(newDf[,2]) * var(newDf[,1]))

Can anyone tell me if both the function and the formula for the unbiased RMSE are correct? The formula was taken from the following publication https://pubag.nal.usda.gov/download/60040/PDF. I have not come across any packages which include a formula for the unbiased RMSE (hydroGOF, tdr) although many organizations seem to use the metric.

In addition, within the paper there appears to be estimation operators. Can this simply be considered as the mean estimated soil moisture value for a given day, or does it need to consider more?



*Edit: Punctuation, tags, formula and added citation