Uniroot Function to find value that sets equation to zero

Hey guys and girls,

I am currently seeking a way to implement the "uniroot" function to my code to find me a value that is setting an equation to zero.

sig_a1 hereby is the standard deviation of delta
sig_e_theoretical is a time series for a statistical way to predict the standard deviation of Equity
Delta and Equity are to vectors with values

sig_e_theoretical_function  <-function(sig_a1,sig_e1,k,RF,C){
  sig_e_theoretical<- sig_a1*(delta[i]/Equity[i])*firstdev_Vt(sig_e1,k,sig_a1,RF,C=Non)

further the error function should find the difference between an empirically predicted sig_e1 and the mean of the function above

error_function <- function(sig_a1,sig_e1,k,RF,C){
  error <- sig_e1 - mean(sig_e_theoretical)

Here comes the problem where I am not sure how to set the uniroot function, that it finds the value to set this equation to zero.

sig_a1_function <- function(sig_a1,sig_e1,k,RF,C){
  sig_a1 <- uniroot(f=error_function,interval=c(sig_e_theoretical_function(sig_a1=sig_a1,sig_e1=sig_e1,k=k,RF=RF,C=IntexpNon),sig_e_theoretical_function(sig_a1=sig_a1,sig_e1=sig_e1,k=k,RF=RF,C=IntexpNon)+20),extendInt = "yes",sig_a1,k,i,tol=1)$root

Thanks for your help!