I try to use the apply function using my own function. However, I keep getting this error: Error in match.fun(FUN) : 'calculate_3month_average_volume(volume_matrix, 90)' is not a function, character or symbol
Code below:
#Calculate 3 monthtly average volume (does not work, coding issue)
calculate_3month_average_volume <- function(stock, number_of_days){
return(SMA(stock, number_of_days))
}
avg_volume_matrix <- apply(X = volume_matrix, MARGIN = 2, FUN = calculate_3month_average_volume(volume_matrix,90))