# Trying to plot REC curve and calculate AUC in R but getting error

I am working on regression machine learning techniques and calculating AUC (plotting REC) by using below paper link: http://homepages.rpi.edu/~bennek/papers/rec.pdf

My Code;

REC <- function(y_val , y_predval){

Accuracy <- "[]"

### initializing the values for Epsilon

Begin_Range <- 0 End_Range <- 1.5 Interval_Size <- 0.01

### List of epsilons

Epsilon <- seq(Begin_Range , End_Range , Interval_Size)

### Main Loops

for (i in range(length(Epsilon))){ count <- 0.0 for (j in range(length(y_val))){ if ((y_val[j] - y_predval[j]) / sqrt((y_val[j]) **2 + (y_predval[j])**2 ) < Epsilon[i]){ count <- count + 1 } append(count/length(y_val)) }
### Calculating Area Under Curve using Simpson's rule AUC <- sintegral(Accuracy , Epsilon ) / End_Range

### returning epsilon , accuracy , area under curve
return (Epsilon , Accuracy , AUC)


} }

AUC <- REC(y_val, y_predval)

Error in np_array(y_val[j])^2 : non-numeric argument to binary operator