[Rd] How to let 'R CMD check' see local libraries

2006-08-20 Thread Sebastian P. Luque
Dear List,

Whenever a package requires another one that is available from a local
library in my user home directory, 'R CMD check' fails here:


* checking package dependencies ... ERROR
Packages required but not available:
  


Here,  is in a library specified in ~/.Renviron:


# local library
R_LIBS="~/R/library:${R_LIBS}"


So it seems 'R CMD check' does not read this file, even though I'm running
it as the user with the ~/.Renviron.

Perhaps one way to get around it is to add my local library to
${R_HOME}/etc/.Renviron, but I'd rather not do that, as I would need to
add it everytime R is upgraded.  Any ideas on other solutions would be
appreciated.  Thanks.


R> version
   _ 
platform   x86_64-pc-linux-gnu   
arch   x86_64
os linux-gnu 
system x86_64, linux-gnu 
status   
major  2 
minor  3.1   
year   2006  
month  06
day01
svn rev38247 
language   R 
version.string Version 2.3.1 (2006-06-01)



Cheers,

-- 
Seb

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to let 'R CMD check' see local libraries

2006-08-20 Thread Seth Falcon
"Sebastian P. Luque" <[EMAIL PROTECTED]> writes:
> Perhaps one way to get around it is to add my local library to
> ${R_HOME}/etc/.Renviron, but I'd rather not do that, as I would need to
> add it everytime R is upgraded.  Any ideas on other solutions would be
> appreciated.  Thanks.

You can export an R_LIBS environment variable from your shell.  Since
I often have at least two versions of R and like to keep the packages
separate, I create a wrapper for each R that looks something like:

#!/bin/bash

export R_LIBS=/Users/seth/RLIB-2.3
/Users/seth/proj/builds/R-2.3/bin/R "$@"

Then R-2.3 CMD INSTALL/check/REMOVE all act on the appropriate
library.

+ seth

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to let 'R CMD check' see local libraries

2006-08-20 Thread Sebastian P. Luque
On Sun, 20 Aug 2006 13:31:41 -0700,
Seth Falcon <[EMAIL PROTECTED]> wrote:

[...]

> #!/bin/bash

> export R_LIBS=/Users/seth/RLIB-2.3 /Users/seth/proj/builds/R-2.3/bin/R "$@"


Thank you, good idea.  I often forget to use all the shell facilities at
hand when building/checking packages.


Cheers,

-- 
Seb

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to let 'R CMD check' see local libraries

2006-08-20 Thread Kasper Daniel Hansen
On Aug 20, 2006, at 2:03 PM, Sebastian P. Luque wrote:

> On Sun, 20 Aug 2006 13:31:41 -0700,
> Seth Falcon <[EMAIL PROTECTED]> wrote:
>
> [...]
>
>> #!/bin/bash
>
>> export R_LIBS=/Users/seth/RLIB-2.3 /Users/seth/proj/builds/R-2.3/ 
>> bin/R "$@"
>
>
> Thank you, good idea.  I often forget to use all the shell  
> facilities at
> hand when building/checking packages.

I might add that I was also bewildered some time ago by the fact that  
R_LIBS "works" for R CMD INSTALL, while .Renviron is not being  
parsed. I guess there is some justification for this...

Kasper

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] S4 'object is not subsettable' in prototype

2006-08-20 Thread John Chambers
When I was introducing the special type for S4 objects, my first 
inclination was to have length(x) for those objects be either NA or an 
error, along the lines that intuitively length(x) means "the number of 
elements in the vector-style object x".  However, that change quickly 
was demonstrated to need MANY revisions to the current code.

As a compromise, my preference would be that S4 objects have length 0.  
That was true before the S4 type was introduced, and if memory serves, 
that was what we expected in early S for objects that were not vectors.  
Maybe we can try that out, at least for 2.4.1.

But as often happens, we have to deal with the fact that R has many 
authors.  That's usually a good thing, but it does mean that different 
corners of the code will be locally sensible, but not globally 
consistent.  (Having just spent the best part of a day "debugging" a 
problem that turned out to be the result of an S3  method for trunc() in 
base that ignored the documented number of arguments, the 
inconsistencies are on my mind at the moment.)

Martin Maechler wrote:
>> "Seth" == Seth Falcon <[EMAIL PROTECTED]>
>> on Fri, 18 Aug 2006 09:54:54 -0700 writes:
>> 
>
> Seth> Martin Maechler <[EMAIL PROTECTED]> writes:
> >> I agree you've found an "infelicity" in the current setup,
> >> since
> >> 
> >> > setClass("A", representation(x="numeric"))
> >> [1] "A"
> >> > getClass("A")@prototype
> >> 
> >> attr(,"x")
> >> numeric(0)
> >> > length(getClass("A")@prototype)
> >> [1] 1
> >> > getClass("A")@prototype[1]
> >> Error in getClass("A")@prototype[1] : object is not subsettable
> >> > 
> >> 
> >> It's not clear yet to me *what* should be changed.
> >> For my taste, if length(object) returns 1, 
> >> I'd typically want that object[1] should be valid;
> >> but I think we already have some (peculiar) exceptions to that
> >> rule. 
>
> Seth> I disagree with the notion that length and "[" should be tightly
> Seth> coupled.  An object having length doesn't have to mean that 
> subsetting
> Seth> makes any sense.  For example, an environment has length, but what
> Seth> should env1[1] return?  And with S4 classes, there are many such
> Seth> examples where "[i]" won't make sense.
>
> You are right.  I was rather thinking of  "basic"  objects
> rather than highly structured objects such as S4 classes.
>
> Note that for me, an environment belongs into the
> category of "peculiar" exceptions ;-)
>
> Martin
>
> Seth> + seth
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>   

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to use R and add-on packages as library in C/C++

2006-08-20 Thread Pai-Hsien Hung


Thanks for your reply.  

  I have already read the manual again, and use the R.dll (Ch 8.2.2) (Am I
right?).  Running the example in the section is OK.  But, when I try to add
"do_matprod" function in the same example, I don't know what args should put
in.  The function description in array.c is SEXP attribute_hidden
do_matprod( SEXP call, SEXP op, SEXP args, SEXP rho), and where I can get
the definition and description of each variables, call, op, args, 

Thanks,

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 18, 2006 10:32 PM
To: Pai-Hsien Hung
Cc: r-devel
Subject: Re: [Rd] How to use R and add-on packages as library in C/C++

This is indeed in the manual you mention.  To use R functions and not just 
standalone libRmath, you need to embed R.

On Fri, 18 Aug 2006, Pai-Hsien Hung wrote:

> Hi,
>   I have a question for building a standalone exe file via C/C++ with R 
>   and add-on packages in Windows (Compiler is VC).  It may looks like 
>   ...
> 
> #include 
> #include 
> 
> int main() {
>   double *x, *y, z;
> 
>   // ... (Variables initial)
> 
>   z = ar( x, ...); 
>   // In this example, I want use the ar (time series) function (in stats
package) 
>   // as a library funciton.
> 
>   // ... (Other statement)
> 
>   return 0;
> }
> 
>   In the "Writing R Extensions" manual, just demo with numerical 
>   functions, not statistical functions.  I don't know is it possible to 
>   use statistical functions (Time series at least) or other functions in 
>   the add-on package, and how to make it.  Thanks for your patient to 
>   reading this. ^^
> 
> 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to use R and add-on packages as library in C/C++

2006-08-20 Thread Prof Brian Ripley
On Mon, 21 Aug 2006, Pai-Hsien Hung wrote:
> 
> 
> Thanks for your reply.  
> 
>   I have already read the manual again, and use the R.dll (Ch 8.2.2) (Am I
> right?).  

I don't know, as it depends on the (unstated) version of R where in the 
manual it is. If I were using VC++, I would be more inclined to use the 
(D)COM interface.

> Running the example in the section is OK.  But, when I try to add
> "do_matprod" function in the same example, I don't know what args should put
> in.  The function description in array.c is SEXP attribute_hidden
> do_matprod( SEXP call, SEXP op, SEXP args, SEXP rho), and where I can get
> the definition and description of each variables, call, op, args, 

That is a private function not in the API nor in the header files.
Indeed, in upcoming versions of R it is not exported from R.dll
(that's what 'attribute_hidden' entails).   Since it is private you will 
not find the information you are seeking in the documentation.

You asked about using code in packages, and this is not in a package.
The time-series functions are in R code, not C code, so I was answering 
the question you actually asked.


> Thanks,
> 
> -Original Message-
> From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 18, 2006 10:32 PM
> To: Pai-Hsien Hung
> Cc: r-devel
> Subject: Re: [Rd] How to use R and add-on packages as library in C/C++
> 
> This is indeed in the manual you mention.  To use R functions and not just 
> standalone libRmath, you need to embed R.
> 
> On Fri, 18 Aug 2006, Pai-Hsien Hung wrote:
> 
> > Hi,
> >   I have a question for building a standalone exe file via C/C++ with R 
> >   and add-on packages in Windows (Compiler is VC).  It may looks like 
> >   ...
> > 
> > #include 
> > #include 
> > 
> > int main() {
> >   double *x, *y, z;
> > 
> >   // ... (Variables initial)
> > 
> >   z = ar( x, ...); 
> >   // In this example, I want use the ar (time series) function (in stats
> package) 
> >   // as a library funciton.
> > 
> >   // ... (Other statement)
> > 
> >   return 0;
> > }
> > 
> >   In the "Writing R Extensions" manual, just demo with numerical 
> >   functions, not statistical functions.  I don't know is it possible to 
> >   use statistical functions (Time series at least) or other functions in 
> >   the add-on package, and how to make it.  Thanks for your patient to 
> >   reading this. ^^
> > 
> > 
> 
> 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] S4 'object is not subsettable' in prototype

2006-08-20 Thread Martin Maechler
> "JMC" == John Chambers <[EMAIL PROTECTED]>
> on Sun, 20 Aug 2006 20:20:45 -0400 writes:

JMC> When I was introducing the special type for S4 objects,
JMC> my first inclination was to have length(x) for those
JMC> objects be either NA or an error, along the lines that
JMC> intuitively length(x) means "the number of elements in
JMC> the vector-style object x".  However, that change
JMC> quickly was demonstrated to need MANY revisions to the
JMC> current code.

JMC> As a compromise, my preference would be that S4 objects
JMC> have length 0.  That was true before the S4 type was
JMC> introduced, and if memory serves, that was what we
JMC> expected in early S for objects that were not vectors.
JMC> Maybe we can try that out, at least for 2.4.1.

That would look more sensible to me as well. Of course this only
applies to S4 objects that are not of an S4 class which has an own
length() method.

BTW, Martin Morgan's original example now "works" in R-devel,
since the (unconditional availability of the) new 'S4' type has
allowed to logically simplify str() there.
"works" in double quotes because the prototype part does not yet really
look nice..

JMC> But as often happens, we have to deal with the fact
JMC> that R has many authors.  That's usually a good thing,
JMC> but it does mean that different corners of the code
JMC> will be locally sensible, but not globally consistent.

(nice saying; I like the wording ..)

JMC> (Having just spent the best part of a day "debugging" a
JMC> problem that turned out to be the result of an S3
JMC> method for trunc() in base that ignored the documented
JMC> number of arguments, the inconsistencies are on my mind
JMC> at the moment.)

(I'm interested in the details, if you can say a bit more; 
 maybe these are not relevant for R-devel ..)

JMC> Martin Maechler wrote:
>>> "Seth" == Seth Falcon <[EMAIL PROTECTED]> on Fri, 18
>>> Aug 2006 09:54:54 -0700 writes:
>>> 
>>
Seth> Martin Maechler <[EMAIL PROTECTED]> writes:
>> >> I agree you've found an "infelicity" in the current
>> setup, >> since
>> >> 
>> >> > setClass("A", representation(x="numeric")) >> [1]
>> "A" >> > getClass("A")@prototype >>  >>
>> attr(,"x") >> numeric(0) >> >
>> length(getClass("A")@prototype) >> [1] 1 >> >
>> getClass("A")@prototype[1] >> Error in
>> getClass("A")@prototype[1] : object is not subsettable
>> >> > 
>> >> 
>> >> It's not clear yet to me *what* should be changed.  >>
>> For my taste, if length(object) returns 1, >> I'd
>> typically want that object[1] should be valid; >> but I
>> think we already have some (peculiar) exceptions to that
>> >> rule.
>> 
Seth> I disagree with the notion that length and "[" should
Seth> be tightly coupled.  An object having length doesn't
Seth> have to mean that subsetting makes any sense.  For
Seth> example, an environment has length, but what should
Seth> env1[1] return?  And with S4 classes, there are many
Seth> such examples where "[i]" won't make sense.
>>  You are right.  I was rather thinking of "basic" objects
>> rather than highly structured objects such as S4 classes.
>> 
>> Note that for me, an environment belongs into the
>> category of "peculiar" exceptions ;-)
>> 
>> Martin
>> 
Seth> + seth

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel