[R] How to use a 'hidden' function directly?

Sharpie chuck at sharpsteen.net
Thu Feb 25 02:54:06 CET 2010



Dale Steele wrote:
> 
> methods(ansari.test)
> stats:::ansari.test.default
> 
> the two functions that are part of ansari.test.default:
> 
> qansari <- function(p, m, n) {
>                 .C(R_qansari, as.integer(length(p)), q = as.double(p),
>                   as.integer(m), as.integer(n))$q
>             }
> 
>  pansari <- function(q, m, n) {
>             .C(R_pansari, as.integer(length(q)), p = as.double(q),
>                 as.integer(m), as.integer(n))$p
>         }
> 

Sorry, I didn't consider this part of your message carefully.  R_quansari
and R_pansari are indeed variables, but they are unexported variables in the
stats namespace.  Therefore if you want to use these functions outside of
their namespace, you will need something like:

  pansari <- function(q, m, n) {
            .C( stats:::R_pansari, as.integer(length(q)), p = as.double(q),
                as.integer(m), as.integer(n))$p
        }

Hope this helps!

-Charlie
-- 
View this message in context: http://n4.nabble.com/How-to-use-a-hidden-function-directly-tp1568392p1568408.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list