Error in eval(expr, envir, enclos) : object 'freq' not found