Thanks, when I modify the function as I think you suggest, I get the
following error:

qansari  <- function(p, m, n) {
                .C("R_qansari", as.integer(length(p)), q = as.double(p),
                  as.integer(m), as.integer(n))$q
            }


> qansari( 0.025, 5, 5)
Error in .C("R_qansari", as.integer(length(p)), q = as.double(p),
as.integer(m),  :
  C symbol name "R_qansari" not in load table

--Dale

On Wed, Feb 24, 2010 at 8:47 PM, Sharpie <ch...@sharpsteen.net> wrote:
>
>
> Dale Steele wrote:
>>
>> I would like to be able to use two functions; qansari and pansari
>> which are found in the
>> function ansari.test.  How can I evaluate these functions
>> independently?  Thanks.  --Dale
>>
>> For example, when I load the function ...
>>
>> qansari <- function(p, m, n) {
>>                 .C(R_qansari, as.integer(length(p)), q = as.double(p),
>>                   as.integer(m), as.integer(n))$q
>>             }
>>
>> and attempt to evaluate ...
>>
>>> qansari( 0.025, 5, 5)
>> Error in qansari(0.025, 5, 5) : object 'R_qansari' not found
>>
>
> If R_qansari is the name of a compiled C subroutine you are trying to
> execute, then it needs to be passed to .C as a quoted string:
>
>  .C( "R_qansari" , as.integer(length(p)), q = as.double(p),
>    as.integer(m), as.integer(n))$q
>
> Otherwise R, as usual, is looking for a *variable* named R_qansari that it
> assumes holds a string that will tell it which C routine to call.  It does
> not find such a variable and gives the error message shown above.
>
>
> -Charlie
>
>
> 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
>>         }
>>
>>
>
> --
> View this message in context: 
> http://n4.nabble.com/How-to-use-a-hidden-function-directly-tp1568392p1568401.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to