R/scorer_simple.R

Defines functions calculateScore.simple

calculateScore.simple <- function(x, y, measurement ){

library(tidyverse)
  thresholddataframe=data_frame(threshold.value=x,score=c(y,"NA"))
  
  result <- vector("numeric", length(measurement))
  for(i in 1:length(measurement)){
    for(j in 1:length(x)){
      if ((measurement[i]>=thresholddataframe[j,1])&&(measurement[i]<thresholddataframe[j+1,1])){
        score=(as.numeric(thresholddataframe[j,2]))}
    
    }
    result[i] <- score
  }
  return(result)
}
Halophila/scorecards documentation built on May 27, 2019, 3:29 p.m.