secant works again when called directly, doesn't work in the knitr file