Sequence generation in a table
On Thu, Dec 9, 2010 at 1:24 PM, Vincy Pyne <vincy_pyne at yahoo.ca> wrote:
yy <- lapply(c(257, 520, 110), seq, to=0, by=-100) yy/360, I get following error. Error in yy/360 : non-numeric argument to binary operator On the other hand, yy[[1]]/365????????? fetches me [1] 0.7138889 0.4361111 0.1583333
What about this?
bond.fun <- function(x, days=360) {x/days}
lapply(yy, bond.fun)
[[1]] [1] 0.7138889 0.4361111 0.1583333 [[2]] [1] 1.44444444 1.16666667 0.88888889 0.61111111 0.33333333 0.05555556 [[3]] [1] 0.30555556 0.02777778
lapply(yy, bond.fun, days=366)
[[1]] [1] 0.7021858 0.4289617 0.1557377 [[2]] [1] 1.42076503 1.14754098 0.87431694 0.60109290 0.32786885 0.05464481 [[3]] [1] 0.30054645 0.02732240