79259865

Date: 2024-12-07 02:55:53
Score: 1.5
Natty:
Report link

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.

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Guillaume