sd takes a vector as an argument, while dailyReturns seems to take a data.frame (you're using nrow on it).
You'd need to change:
mutate(yrReturn=sapply(StockReturns[row_number()+1], yearReturn))
to
mutate(yrReturn=sapply(StockReturns[row_number()+1,], yearReturn))
So it sends a data.frame to the sub function.