I am using RProvider with F# in VS2012. I would like to pass an array of custom histogram breaks (bin edges) to R.hist. Things are ok when I pass an integer number (see line that is commented out). Could you please help me? What is the correct way to handle function overloading in this case?
R documentation on R.hist is here (see "break" arg): https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/hist.html
A working example below:
let arr = [| 12.3; 12.4; 13.3; 12.9; 13.2; 13.6 |]
let breaks = [| 12.0; 12.5; 13.0; 13.5; 14.0 |]
let h_tmp = R.hist(namedParams ["x", box arr;
"breaks", box breaks; // <------ fails here!
"plot", box true; ])
let h_counts = h_tmp.AsList().["counts"].AsNumeric().GetValue<float[]>()
Many thanks.
What error are you getting?
I tried reproducing this on my machine with the latest RProvider 1.1.15 and it runs without any error and produces the following results, which seems to be correct:
val h_counts : float [] = [|2.0; 1.0; 2.0; 1.0|]