Hey everyone, I am trying to create a data frame (Mantle) by attaching vectors Age, HR, AB, and the y component of the list hr_rates using the data.frame function but I keep getting an error when I run the last line of code
hr_rates <- function(age, hr, ab){
rates <- round(100 * hr/ ab, 1)
list(x = age, y = rates)
}
source("scripts/hr_rates.R" )
HR <- c(13,23,21,27,37,52,34,42,31,40,54)
AB<- c(341,549,461,543,517,533,474,519,541,527,514)
Age <- 19:29
hr_rates(Age, HR, AB )
Mantle <- (data.frame(Age, HR, AB, Rates = hr_rates$y))
Error in hr_rates$y : object of type 'closure' is not subsettable
I'm going off of the code in a book and I can't figure out how to get rid of this error, any help would be greatly appreciated