I'm using tvm from the financial package to try to calc number of periods for each row in a data frame
This gives me the correct answer for a single set of inputs:
tvm(i=28.99, pv=3929.02, pmt=-167.61, n=NA)
and the three lines below throw the error I've pasted at the bottom
sam <- data.frame(28.99, 3929.02, 167.61, NA)
sam
z <- tvm(i=sam$X28.99, pv=sam$X2929.02, pmt=-sam$X167.61, n=sam$NA.)
Error in tvm(i = sam$X28.99, pv = sam$X2929.02, pmt = -sam$X167.61, n = sam$NA.) : Incorrect number of Not Available values