I know how to log-transform a histogram, but how do I apply such a transformation to the actual variable in the dataset? I've searched Google but all the results pertain to viewing transformed data, not actually transforming it.

I know that I can just define an object, such as "log_variable <- log(variable)," but I'm running ANOVA and I don't know if or how I can run it on an object and not the dataset variable itself.

Are you looking for a way to have a logged version of the variable as a column in your data frame? Then you just need to assign it to the data frame when you do the transformation:

data$variable_log <- log(data$variable)

And then call data$variable_log instead of data$variable when you run your ANOVA.