I have a two lists of named data in R. They are different min and max generations from energy sources.
mins <- bind_rows(april.mins, may.maxs)
maxs <- bind_rows(april.maxs, may.maxs)
mins <- lapply(mins, mean)
maxs <- lapply(maxs, mean)
I am attempting to write a function that will let me generate 600 random values from the different mins and maxs by the different named sources and then storing them.
vals <- function(source){
runif(600, min = mins$source, max = max$source)
}
When I individually run this, I am able to generate the random values. For ex:
runif(600, min = mins$biogas, max = maxs$biogas)
However, as the function, it returns an "invalid arguments" error.
vals(geothermal)
Any insight would be much appreciated. Thank you!