You have no object called avg1 in your workspace. Please go back and explore the reason why. Check the input and output of every command, and also learn ways how to look inside the contents of your objects via, for example, head() and tail(), and learn about index sub-setting of data-frames and -matrices, and also tibbles.
A hint: 'avg1' seems to just be a column name in your bat_02 object
Please go carefully through each of your commands and study the input and output. You are not saving the output of your following command (it is just being printed to screen):
sum(object[object$avg1>0.2,]$avg1)
once you save the object