Call a function from c++ via environment Rcpp

fivenum function is not defined in the global environment but in the stats package enviroment, so you should get it from that:

...
Environment stats("package:stats"); 
Function f = stats["fivenum"];
...