So I am trying to take percent changes of a list of numbers. However when I try to call upon the previous element it regards it as the current element minus 1. How may I fix this? Ex. list = (1,2,3), I want to return (n/a, 1, .5) [n/a, (2-1)/1, (3-2)/2]
percent_change <- function(a,b,c,d,e,f,g,h,i,j,k,l){
dataList <- list(a,b,c,d,e,f,g,h,i,j,k,l)
for(i in dataList){print((i-(i-1))/(i-1))}
}