Hi, Prof Duncan

I am sorry to report to a wrong place. But I am lucky to meet you by
chance, right? Thanks first ^^

1. The variable y1 is an array get from Perl, each element is from a
database (the type should be numeric). Here is the code for that. 

        
        $query = qq{
        select exonCount, count(hsEnsGene) as geneCount from countTop1000ks group by exonCount order by exonCount;
        }; 
        $sql=$orthologDB->prepare($query);
        $sql->execute()or die "Could not execute '$query' ...";
        
        my @x1; my @y1;
        while(my($exonCount, $geneCount) = $sql->fetchrow_array())
        {
           push(@x1, $exonCount);
           push(@y1, $geneCount);
        }


Here is the result if I print out the value in @y1: 

        print "y1---",join(" ",@y1), "---end\n";

% y1---101 44 33 26 8 15 18 13 3 5 4 2 1 4 1 1---end

But when I call 

        &R::callWithNames("barplot", {'',\@y1, 'main', 'Barplot the Gene number per exon with top1000 low Ks', 'xlab', "Exon(low ks) number in the gene",'ylab', 'Numbers of gene'});

It always says non-numeric argument:

% Error in -0.01 * height : non-numeric argument to binary operator

If I asign the value to another array, like 

        my @x=(101, 44, 33, 26, 8, 15, 18, 13, 3, 5, 4, 2, 1, 4, 1, 1);
        &R::callWithNames("barplot", {'',\@x, 'main', 'Barplot the Gene number per exon with top1000 low Ks', 'xlab', "Exon(low ks) number in the gene",'ylab', 'Numbers of gene'});

then it works.

I don't know why and what the difference is.

I also thought whether it is because of the different data type between
Perl and R, because in Perl, "3" and 3 could be same sometime. So I
call 

        &R::callWithNames("as.numeric",{'',\@y1});

before I call 

        &R::callWithNames("barplot", {'',\@y1});

Same error!

Same case if I change to use the R::boxplot(\@y1) as you said.

I am not sure I explain clear this time.

Looking forwards to your response!

Regards,

-Xianjun



On Thu, 2006-09-21 at 07:33 -0700, Duncan Temple Lang wrote: 

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> 
> Hi Xianjun
> 
> [Important: Please don't send mail about an R package to r-bugs. That is
> for reporting bugs in R itself. Add on packages are different
> and it is only a coincidence that I am one of the R-core developers
> and package author.  In general, all bug reports about
> a package should be sent to the author  and questions should go to the
> author and the r-devel or r-help list as appropriate.]
> 
> 
> Is the problem you report a bug? Well not necessarily in RSPerl,
> but in your code.  Unfortunately, you haven't told me what
> the variable y1 contains so it is hard to figure out what
> is going into the computations.
> 
> A couple of things:
>  a) Your example is calling boxplot in the first call and barplot
>     in the second.
> 
>   b) in the first example, you are passing @y1 and in the second
>     you are passing \@y1.
> 
>      I would guess that \@y1 is more appropriate and you might try that
>      in the first case.
> 
>   c) the first case doesn't have any named arguments (just '') so why
>      use callWithNames.  Just R::boxplot(\@y1)
> 
> 
> You are calling the R functions, but you are getting an error during
> the invocation. The error message is coming from R.  So the
> problem is that you are passing inputs to the functions that it cannot
> handle.  This can happen directly in R and so also in RSPerl.  My guess
> is that you don't have the correct type of data in @y1 or that you are
> not passing it in the call as a reference.
> 
> Xianjun Dong wrote:
> > Hi, 
> > 
> > It looks that not all function in R could be implemented by RSPerl. For
> > example,  when I call
> > 
> > &R::callWithNames("boxplot", {'',@y1});
> > or
> > R::barplot(\@y1);
> > 
> > There would be error:
> > 
> > Error in -0.01 * height : non-numeric argument to binary operator
> > Caught error in R::call()
> > 
> > The same happened when calling "barplot", but it's ok to call plot.
> > 
> > Is it a bug?
> > 
> 
> - --
> Duncan Temple Lang                    duncan@wald.ucdavis.edu
> Department of Statistics              work:  (530) 752-4782
> 4210 Mathematical Sciences Building   fax:   (530) 752-7099
> One Shields Ave.
> University of California at Davis
> Davis,
> CA 95616,
> USA
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (Darwin)
> 
> iD8DBQFFEqKy9p/Jzwa2QP4RAoVcAJ4rK3CKGBCxlgdlJYke59l/Rm4rAQCffS1x
> nhSyWBrhQre0UXvv3DKD0KI=
> =EVsZ
> -----END PGP SIGNATURE-----

	[[alternative HTML version deleted]]


