finstr icon indicating copy to clipboard operation
finstr copied to clipboard

Error re: Non-numeric variable in data frame: date

Open mbadros opened this issue 8 years ago • 0 comments

Thanks for your work on this very interesting package. I'm getting following error (traceback copied below) using R 3.4.2 (on a Windows 64-bit machine). There's something about the date not being numeric (which it clearly isn't -- it's a string ordinarily; I've modified it to be a date in the below example) ... but I don't know why that matters to the data frame.

Any thoughts?

Mark

> pnl %>% calculate(calculations = profit_margins, digits = 2)
 Hide Traceback
 
 Rerun with Debug
 Error in Math.data.frame(list(Net_Margin = c(0.0947474225936983, 0.100807355791349,  : 
  non-numeric variable in data frame: date 
11.
stop("non-numeric variable in data frame: ", vnames[!mode.ok]) 
10.
Math.data.frame(structure(list(Net_Margin = c(0.0947474225936983, 
0.100807355791349, 0.107839975743066, 0.116888930060399, 0.120758688137547
), date = structure(c(15705, 16070, 16435, 16800, 17166), class = "Date")), .Names = c("Net_Margin", 
"date"), class = "data.frame", row.names = c(NA, -5L)), 2) 
9.
calculate(., calculations = profit_margins, digits = 2) 
8.
function_list[[k]](value) 
7.
withVisible(function_list[[k]](value)) 
6.
freduce(value, `_function_list`) 
5.
`_fseq`(`_lhs`) 
4.
eval(quote(`_fseq`(`_lhs`)), env, env) 
3.
eval(quote(`_fseq`(`_lhs`)), env, env) 
2.
withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) 
1.
pnl %>% calculate(calculations = profit_margins, digits = 2) 

mbadros avatar Nov 30 '17 03:11 mbadros