Re: [Rd] R-forge, package dependencies

2013-01-16 Thread Martin Maechler
 Nick Sabbe nick.sa...@ugent.be
 on Tue, 15 Jan 2013 21:34:52 +0100 writes:

 I have exactly the same issue with a pair of my packages
 on R-Forge.  I've already notified Stefan, but I mentioned
 it wasn't urgent for me :)

 It must have something to do with the R check using a
 different environment than the build...

notably when using '--as-cran' I think;
this looks like a pretty infelicitous decision to me:

E.g. I can no longer use --as-cran for checking our copula
package (on my own computer), as that suggests Rmpfr and gmp and
these depend on the corresponding external C libraries (mpfr  gmp) 
and these rely on LD_LIBRARY_PATH and that now fails to be
looked at in such circumstances.

To me this somewhat recent change looks like something that
should be re-considered on the R side..

Martin

 So good hunting, Stefan!
indeed...


 Nick Sabbe
 --
 ping: nick.sa...@ugent.be link: http://biomath.ugent.be
 wink: A1.056, Coupure Links 653, 9000 Gent ring:
 09/264.59.36

 -- Do Not Disapprove




 -Original Message- From:
 r-devel-boun...@r-project.org
 [mailto:r-devel-boun...@r-project.org] On Behalf Of Uwe
 Ligges Sent: dinsdag 15 januari 2013 21:09 To: Thomas
 Lumley Cc: Stefan Theussl; R-devel Subject: Re: [Rd]
 R-forge, package dependencies



 On 15.01.2013 20:47, Thomas Lumley wrote:
 I have a project on R-forge
 (sqlsurvey.r-forge.r-project.org) with two packages,
 RMonetDB and sqlsurvey.
 
 At the moment, sqlsurvey is listed as failing to build.
 The error is on the Linux package check, which says that
 RMonetDB is not available:
 
 
 * checking package dependencies ... ERROR Package
 required but not available: 'RMonetDB'
 
 RMonetDB has built successfully: r-forge lists its status
 as 'current', with Linux, Windows, and Mac packages
 available for download.  The package check for sqlsurvey
 on Windows and Mac finds RMonetDB without any problems,
 it's just on Linux that it appears to be
 unavailable.
 
 Any suggestions for how to fix this? I've tried uploading
 a new version of RMonetDB, but the situation didn't
 change: it built successfully, but the Linux check of
 sqlsurvey still couldn't find it.


 I think you have to ask Stefan to check the details.

 Best, Uwe


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

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

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

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


Re: [Rd] R-forge, package dependencies

2013-01-16 Thread Mengsteab Aregay
Hi,
the same error was happen to me as well. it doesn't have problem with mac
and windows but there is package dependencies with Linux platform. this is
something i don't get a solution yet. so what I've done is, I simply check
on win-builder for machine dependencies and on my local machine as well,
then I built and submitted it to cran using ftp. But still the issue
for Linux and r forge is what i can't get a solution.

Regards,
Michael


On Wed, Jan 16, 2013 at 9:31 AM, Martin Maechler maech...@stat.math.ethz.ch
 wrote:

  Nick Sabbe nick.sa...@ugent.be
  on Tue, 15 Jan 2013 21:34:52 +0100 writes:

  I have exactly the same issue with a pair of my packages
  on R-Forge.  I've already notified Stefan, but I mentioned
  it wasn't urgent for me :)

  It must have something to do with the R check using a
  different environment than the build...

 notably when using '--as-cran' I think;
 this looks like a pretty infelicitous decision to me:

 E.g. I can no longer use --as-cran for checking our copula
 package (on my own computer), as that suggests Rmpfr and gmp and
 these depend on the corresponding external C libraries (mpfr  gmp)
 and these rely on LD_LIBRARY_PATH and that now fails to be
 looked at in such circumstances.

 To me this somewhat recent change looks like something that
 should be re-considered on the R side..

 Martin

  So good hunting, Stefan!
 indeed...


  Nick Sabbe
  --
  ping: nick.sa...@ugent.be link: http://biomath.ugent.be
  wink: A1.056, Coupure Links 653, 9000 Gent ring:
  09/264.59.36

  -- Do Not Disapprove




  -Original Message- From:
  r-devel-boun...@r-project.org
  [mailto:r-devel-boun...@r-project.org] On Behalf Of Uwe
  Ligges Sent: dinsdag 15 januari 2013 21:09 To: Thomas
  Lumley Cc: Stefan Theussl; R-devel Subject: Re: [Rd]
  R-forge, package dependencies



  On 15.01.2013 20:47, Thomas Lumley wrote:
  I have a project on R-forge
  (sqlsurvey.r-forge.r-project.org) with two packages,
  RMonetDB and sqlsurvey.
 
  At the moment, sqlsurvey is listed as failing to build.
  The error is on the Linux package check, which says that
  RMonetDB is not available:
 
 
  * checking package dependencies ... ERROR Package
  required but not available: 'RMonetDB'
 
  RMonetDB has built successfully: r-forge lists its status
  as 'current', with Linux, Windows, and Mac packages
  available for download.  The package check for sqlsurvey
  on Windows and Mac finds RMonetDB without any problems,
  it's just on Linux that it appears to be
  unavailable.
 
  Any suggestions for how to fix this? I've tried uploading
  a new version of RMonetDB, but the situation didn't
  change: it built successfully, but the Linux check of
  sqlsurvey still couldn't find it.


  I think you have to ask Stefan to check the details.

  Best, Uwe


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

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

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

 __
 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


[Rd] How to call Java main method using rJava package?

2013-01-16 Thread Gaurav Dasgupta
Hi,

I am trying to integrate my Java program with R using rJava package. I want
to execute the whole Java program from R. The main() method in my Java code
calls all the other defined methods. So, I guess I have to call the main()
method in .jcall.

An example Java code:

*class A {
public static int mySum(int x, int y) {
return x+y;
}
public static void main (String[] arg) {
System.out.println(The sum is  + mySum(2, 4));
}
}*

I can do the following to call the mySum() method:
*.jcall(obj, I, mySum, as.integer(2), as.integer(4))*
This will give the output *6*.

But can some one explain me that how exactly I can execute this program to
print *The sum is 6* from R? OR how can I call the main method?
I am a beginner in R.

Thanks,
Gaurav

[[alternative HTML version deleted]]

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


[Rd] Small clarification to R-exts, questions on ptr_do_selectlist

2013-01-16 Thread Thomas Friedrichsmeier
Hi,

1. I suggest adding the following piece of advice at the end of the section 
describing R_getEmbeddingDllInfo() (currently 8.1.3) in R-exts.texi:

---
In order to call registered symbols of the embedding application from a
package, you have to specify @code{PACKAGE = (embedding)} in
@code{.C}, @code{.Call}, etc.
---

2. Section 8.1.2 of R-exts.text (Setting R callbacks) has a new line These 
callbacks should never be changed in a running R session (and hence cannot be 
called from an extension package). I had a bit of difficulty understanding 
what These refers to. I believe it's meant to refer to the above 
callbacks, only, and I suggest using that wording for easier reading.

3. While reading the sources, trying to understand how to make use of 
prt_do_selectlist, it seems that this is not actually used to 
utils::select.list(), unless 
  (.Platform$OS.type == windows || .Platform$GUI == AQUA)
Is this intended?
In fact, from reading src/library/utils/src/stubs.c, it looks like 
ptr_do_selectlist (and ptr_do_data(entry|viewer), ptr_R_(add|load|
save)history) is ignored on Windows, although - from a naive POV - it would 
seem easy enough to make it functional across platforms(*).

Regards
Thomas


(*) E.g. changing the selectlist stub to:
--
SEXP selectlist(SEXP call, SEXP op, SEXP args, SEXP env)
{
if(ptr_do_selectlist) return ptr_do_selectlist(call, op, CDR(args), env);
#ifdef Win32
return Win_selectlist(CDR(args));
#else
return R_NilValue;
#endif
}
--
and removing the Windows specific stub, earlier in the file.


signature.asc
Description: This is a digitally signed message part.
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Trouble building package using R in development

2013-01-16 Thread Gavin Simpson
Dear List,

I'm having considerable trouble setting up my environment (Linux, Fedora
16, Bash) to build and check packages under R Under Development
(r61660). I'm doing this to better get a handle on difference in the
output from running checks on examples in one of my packages. Note I
compiled R Under Development myself

The problem I am now having is whenever I try to build my analogue
package using R Under Development, R complains about a dependency having
been built before R 3.0.0. I obviously don't have my environment
variables set correctly, but I don't see why or how R is finding my
daily-use package library; if anything I would have expected it to fail
with a missing dependency.

If I start Rdevel with --vanilla (to mimic Rdevel CMD build) I see:

 .libPaths()
[1] /home/gavin/R/devlibs /home/gavin/R/devel/build/library

the first entry there is because I have temporarily set R_LIBS to that
directory via export R_LIBS=/home/gavin/R/devlibs. From there we see I
have versions of the dependencies installed in this library and they are
built with 3.0.0:

 installed.packages(~/R/devlibs/)[, Built, drop = FALSE]
  Built  
analogue  3.0.0
ctv   3.0.0
permute   3.0.0
princurve 3.0.0
rgl   3.0.0
scatterplot3d 3.0.0
vegan 3.0.0

Note that there are no other versions of vegan inadvertently installed
to the build directory for R Under Development.

Following advice in Writing R Extensions I have also created
~/build.Renviron and ~/check.Renviron and as these are non-standard I
also followed the advice to set R_BUILD_ENVIRON and R_CHECK_ENVIRON
again temporarily via export:

$ cat $R_CHECK_ENVIRON
R_LIBS=/home/gavin/R/devlibs

$ cat $R_BUILD_ENVIRON
R_LIBS=/home/gavin/R/devlibs

Yet still I get errors building analogue:

$ Rdevel CMD build ../analogue/pkg/
* checking for file ‘../analogue/pkg/DESCRIPTION’ ... OK
* preparing ‘analogue’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to re-build vignettes
  ---
* installing *source* package ‘analogue’ ...
** libs
gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
-I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=core2 
-fasynchronous-unwind-tables  -c c_distx.c -o c_distx.o
gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
-I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=core2 
-fasynchronous-unwind-tables  -c c_distxy.c -o c_distxy.o
gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
-I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=core2 
-fasynchronous-unwind-tables  -c distx.c -o distx.o
gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
-I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=core2 
-fasynchronous-unwind-tables  -c distxy.c -o distxy.o
gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
-I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -march=core2 
-fasynchronous-unwind-tables  -c wastats.c -o wastats.o
gcc -std=gnu99 -shared -L/usr/local/lib64 -o analogue.so c_distx.o c_distxy.o 
distx.o distxy.o wastats.o
installing to /tmp/Rtmpctxbtv/Rinst30e3f762569/analogue/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error : package ‘vegan’ was built before R 3.0.0: please re-install it
ERROR: lazy loading failed for package ‘analogue’
* removing ‘/tmp/Rtmpctxbtv/Rinst30e3f762569/analogue’
  ---
ERROR: package installation failed

Can anyone suggest where to go from here?

TIA

Gavin
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [Rd] How to call Java main method using rJava package?

2013-01-16 Thread Simon Urbanek

On Jan 16, 2013, at 7:32 AM, Gaurav Dasgupta wrote:

 Hi,
 
 I am trying to integrate my Java program with R using rJava package. I want
 to execute the whole Java program from R. The main() method in my Java code
 calls all the other defined methods. So, I guess I have to call the main()
 method in .jcall.
 
 An example Java code:
 
 *class A {
public static int mySum(int x, int y) {
return x+y;
}
public static void main (String[] arg) {
System.out.println(The sum is  + mySum(2, 4));
}
 }*
 
 I can do the following to call the mySum() method:
 *.jcall(obj, I, mySum, as.integer(2), as.integer(4))*
 This will give the output *6*.
 
 But can some one explain me that how exactly I can execute this program to
 print *The sum is 6* from R? OR how can I call the main method?

.jcall(A,V,main,.jarray(list(), java/lang/String)

But note that System.out is sent to stdout by Java so it won't output in the R 
console as R output so you should really avoid it.

You may consider using the stats-rosuda-devel mailing list for rJava questions.

Cheers,
Simon


 I am a beginner in R.
 
 Thanks,
 Gaurav
 
   [[alternative HTML version deleted]]
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
 
 

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


Re: [Rd] Trouble building package using R in development

2013-01-16 Thread Gavin Simpson
As a follow-up, shortly after I clicked send I decided to do something
silly and rename my ~/.Renviron (which set R_LIBS too). Silly because
the Writing R Extensions (WRE) manual says that these startup files are
not read as R is invoked with --vanilla.

Once I renamed ~/.Renviron so it was not being read I was able to build
the package using R Under Development following the remaining
instructions in the WRE note [1]

So I do wonder if I have misunderstood the note in WRE or if there is
some other issue here? Starting R --vanilla with R Under Development
wasn't reading ~/.Renviron, and by renaming ~/.Renviron that I was able
to build the package indicates that this file was implicated in the
problem I described.

Is it intentional that R CMD build reads ~/.Renviron ? If it is, then
WRE should ideally clarify this or make it explicit. If it wasn't
supposed to be read, is there a bug here?

All the best,

Gavin

[1]
http://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Checking-and-building-packages

On Wed, 2013-01-16 at 16:05 +0100, Gavin Simpson wrote:
 Dear List,
 
 I'm having considerable trouble setting up my environment (Linux, Fedora
 16, Bash) to build and check packages under R Under Development
 (r61660). I'm doing this to better get a handle on difference in the
 output from running checks on examples in one of my packages. Note I
 compiled R Under Development myself
 
 The problem I am now having is whenever I try to build my analogue
 package using R Under Development, R complains about a dependency having
 been built before R 3.0.0. I obviously don't have my environment
 variables set correctly, but I don't see why or how R is finding my
 daily-use package library; if anything I would have expected it to fail
 with a missing dependency.
 
 If I start Rdevel with --vanilla (to mimic Rdevel CMD build) I see:
 
  .libPaths()
 [1] /home/gavin/R/devlibs /home/gavin/R/devel/build/library
 
 the first entry there is because I have temporarily set R_LIBS to that
 directory via export R_LIBS=/home/gavin/R/devlibs. From there we see I
 have versions of the dependencies installed in this library and they are
 built with 3.0.0:
 
  installed.packages(~/R/devlibs/)[, Built, drop = FALSE]
   Built  
 analogue  3.0.0
 ctv   3.0.0
 permute   3.0.0
 princurve 3.0.0
 rgl   3.0.0
 scatterplot3d 3.0.0
 vegan 3.0.0
 
 Note that there are no other versions of vegan inadvertently installed
 to the build directory for R Under Development.
 
 Following advice in Writing R Extensions I have also created
 ~/build.Renviron and ~/check.Renviron and as these are non-standard I
 also followed the advice to set R_BUILD_ENVIRON and R_CHECK_ENVIRON
 again temporarily via export:
 
 $ cat $R_CHECK_ENVIRON
 R_LIBS=/home/gavin/R/devlibs
 
 $ cat $R_BUILD_ENVIRON
 R_LIBS=/home/gavin/R/devlibs
 
 Yet still I get errors building analogue:
 
 $ Rdevel CMD build ../analogue/pkg/
 * checking for file ‘../analogue/pkg/DESCRIPTION’ ... OK
 * preparing ‘analogue’:
 * checking DESCRIPTION meta-information ... OK
 * cleaning src
 * installing the package to re-build vignettes
   ---
 * installing *source* package ‘analogue’ ...
 ** libs
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 c_distx.c -o c_distx.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 c_distxy.c -o c_distxy.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 distx.c -o distx.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 distxy.c -o distxy.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 wastats.c -o wastats.o
 gcc -std=gnu99 -shared -L/usr/local/lib64 -o analogue.so c_distx.o c_distxy.o 
 distx.o distxy.o wastats.o
 installing to /tmp/Rtmpctxbtv/Rinst30e3f762569/analogue/libs
 ** R
 ** data
 ** inst
 ** byte-compile and prepare package for lazy loading
 Error : package ‘vegan’ was built before R 3.0.0: please re-install it
 ERROR: lazy loading failed for package 

[Rd] Declaring/importing non-exported functions [car] in another package

2013-01-16 Thread Michael Friendly
A new function in my heplots package wants to use a non-exported utility 
function in the car package,
df.terms, but this depends on other non-exported functions.
 From the Writing R extensions manual, I thought I could do this via (in 
my NAMESPACE)

importFrom(car, car:::df.terms, car:::df.terms.default, car:::is.aliased)

but I get:
** preparing package for lazy loading
Error : objects 'car:::df.terms', 'car:::df.terms.default', 
'car:::is.aliased' are not exported by 'namespace:car'
ERROR: lazy loading failed for package 'heplots'

\S 1.6.1 of the manual says regarding importFrom():
Using |foo:::f| instead of |foo::f| allows access to unexported objects. 
This is generally not recommended, as the semantics of unexported 
objects may be changed by the package author in routine maintenance.

Questions:
1.  Why doesn't this work?
2.  Is my only alternative to copy these functions to my package, also 
unexported?

thx,
-Michael

-- 
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.  Chair, Quantitative Methods
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA


[[alternative HTML version deleted]]

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


Re: [Rd] Declaring/importing non-exported functions [car] in another package

2013-01-16 Thread Duncan Murdoch

On 13-01-16 11:25 AM, Michael Friendly wrote:

A new function in my heplots package wants to use a non-exported utility
function in the car package,
df.terms, but this depends on other non-exported functions.
  From the Writing R extensions manual, I thought I could do this via (in
my NAMESPACE)

importFrom(car, car:::df.terms, car:::df.terms.default, car:::is.aliased)

but I get:
** preparing package for lazy loading
Error : objects 'car:::df.terms', 'car:::df.terms.default',
'car:::is.aliased' are not exported by 'namespace:car'
ERROR: lazy loading failed for package 'heplots'

\S 1.6.1 of the manual says regarding importFrom():
Using |foo:::f| instead of |foo::f| allows access to unexported objects.
This is generally not recommended, as the semantics of unexported
objects may be changed by the package author in routine maintenance.

Questions:
1.  Why doesn't this work?


I think you misread the manual.  It is talking about ways to access 
functions other than by using importFrom.  You can use car:::df.terms in 
your functions.



2.  Is my only alternative to copy these functions to my package, also
unexported?


Using car:::df.terms explicitly is another option.

Another possibility is for the car maintainer (John Fox) to export that 
function from car.


Duncan Murdoch

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


Re: [Rd] Declaring/importing non-exported functions [car] in another package

2013-01-16 Thread Michael Friendly
On 1/16/2013 11:40 AM, Duncan Murdoch wrote:

 \S 1.6.1 of the manual says regarding importFrom():
 Using |foo:::f| instead of |foo::f| allows access to unexported objects.
 This is generally not recommended, as the semantics of unexported
 objects may be changed by the package author in routine maintenance.

 Questions:
 1.  Why doesn't this work?

 I think you misread the manual.  It is talking about ways to access 
 functions other than by using importFrom.  You can use car:::df.terms 
 in your functions.
Thanks for the clarification, but I blame the manual. Could I suggest a 
change in the manual to make this clearer:

Using |foo:::f| directly in a function  instead of |foo::f| allows 
access to unexported objects (rather than in importsFrom()). ...


-- 
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.  Chair, Quantitative Methods
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA


[[alternative HTML version deleted]]

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


Re: [Rd] Trouble building package using R in development

2013-01-16 Thread Henrik Bengtsson
On Wed, Jan 16, 2013 at 7:25 AM, Gavin Simpson gavin.simp...@ucl.ac.uk wrote:
 As a follow-up, shortly after I clicked send I decided to do something
 silly and rename my ~/.Renviron (which set R_LIBS too). Silly because
 the Writing R Extensions (WRE) manual says that these startup files are
 not read as R is invoked with --vanilla.

 Once I renamed ~/.Renviron so it was not being read I was able to build
 the package using R Under Development following the remaining
 instructions in the WRE note [1]

 So I do wonder if I have misunderstood the note in WRE or if there is
 some other issue here? Starting R --vanilla with R Under Development
 wasn't reading ~/.Renviron, and by renaming ~/.Renviron that I was able
 to build the package indicates that this file was implicated in the
 problem I described.

 Is it intentional that R CMD build reads ~/.Renviron ? If it is, then
 WRE should ideally clarify this or make it explicit. If it wasn't
 supposed to be read, is there a bug here?

FYI, related posts:

* Rd thread 'R devel [and R 2.14.1 patched]: R CMD build now sources
~/.Rprofile' on Feb 23, 2012
[https://stat.ethz.ch/pipermail/r-devel/2012-February/063365.html]
* Rd thread 'R CMD build/check on Windows 7' on Jul 17, 2012
[https://stat.ethz.ch/pipermail/r-devel/2012-July/064427.html]

To circumvent this, I check using:

R --no-init-file CMD check foo_1.0.tar.gz

/Henrik


 All the best,

 Gavin

 [1]
 http://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Checking-and-building-packages

 On Wed, 2013-01-16 at 16:05 +0100, Gavin Simpson wrote:
 Dear List,

 I'm having considerable trouble setting up my environment (Linux, Fedora
 16, Bash) to build and check packages under R Under Development
 (r61660). I'm doing this to better get a handle on difference in the
 output from running checks on examples in one of my packages. Note I
 compiled R Under Development myself

 The problem I am now having is whenever I try to build my analogue
 package using R Under Development, R complains about a dependency having
 been built before R 3.0.0. I obviously don't have my environment
 variables set correctly, but I don't see why or how R is finding my
 daily-use package library; if anything I would have expected it to fail
 with a missing dependency.

 If I start Rdevel with --vanilla (to mimic Rdevel CMD build) I see:

  .libPaths()
 [1] /home/gavin/R/devlibs /home/gavin/R/devel/build/library

 the first entry there is because I have temporarily set R_LIBS to that
 directory via export R_LIBS=/home/gavin/R/devlibs. From there we see I
 have versions of the dependencies installed in this library and they are
 built with 3.0.0:

  installed.packages(~/R/devlibs/)[, Built, drop = FALSE]
   Built
 analogue  3.0.0
 ctv   3.0.0
 permute   3.0.0
 princurve 3.0.0
 rgl   3.0.0
 scatterplot3d 3.0.0
 vegan 3.0.0

 Note that there are no other versions of vegan inadvertently installed
 to the build directory for R Under Development.

 Following advice in Writing R Extensions I have also created
 ~/build.Renviron and ~/check.Renviron and as these are non-standard I
 also followed the advice to set R_BUILD_ENVIRON and R_CHECK_ENVIRON
 again temporarily via export:

 $ cat $R_CHECK_ENVIRON
 R_LIBS=/home/gavin/R/devlibs

 $ cat $R_BUILD_ENVIRON
 R_LIBS=/home/gavin/R/devlibs

 Yet still I get errors building analogue:

 $ Rdevel CMD build ../analogue/pkg/
 * checking for file ‘../analogue/pkg/DESCRIPTION’ ... OK
 * preparing ‘analogue’:
 * checking DESCRIPTION meta-information ... OK
 * cleaning src
 * installing the package to re-build vignettes
   ---
 * installing *source* package ‘analogue’ ...
 ** libs
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 c_distx.c -o c_distx.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 c_distxy.c -o c_distxy.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 distx.c -o distx.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 distxy.c -o distxy.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 

Re: [Rd] Trouble building package using R in development

2013-01-16 Thread Henrik Bengtsson
On Wed, Jan 16, 2013 at 8:59 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote:
 On Wed, Jan 16, 2013 at 7:25 AM, Gavin Simpson gavin.simp...@ucl.ac.uk 
 wrote:
 As a follow-up, shortly after I clicked send I decided to do something
 silly and rename my ~/.Renviron (which set R_LIBS too). Silly because
 the Writing R Extensions (WRE) manual says that these startup files are
 not read as R is invoked with --vanilla.

 Once I renamed ~/.Renviron so it was not being read I was able to build
 the package using R Under Development following the remaining
 instructions in the WRE note [1]

 So I do wonder if I have misunderstood the note in WRE or if there is
 some other issue here? Starting R --vanilla with R Under Development
 wasn't reading ~/.Renviron, and by renaming ~/.Renviron that I was able
 to build the package indicates that this file was implicated in the
 problem I described.

 Is it intentional that R CMD build reads ~/.Renviron ? If it is, then
 WRE should ideally clarify this or make it explicit. If it wasn't
 supposed to be read, is there a bug here?

 FYI, related posts:

 * Rd thread 'R devel [and R 2.14.1 patched]: R CMD build now sources
 ~/.Rprofile' on Feb 23, 2012
 [https://stat.ethz.ch/pipermail/r-devel/2012-February/063365.html]
 * Rd thread 'R CMD build/check on Windows 7' on Jul 17, 2012
 [https://stat.ethz.ch/pipermail/r-devel/2012-July/064427.html]

 To circumvent this, I check using:

 R --no-init-file CMD check foo_1.0.tar.gz

Should have clarified that in your case you need to add '--no-environ'.

/Henrik


 /Henrik


 All the best,

 Gavin

 [1]
 http://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Checking-and-building-packages

 On Wed, 2013-01-16 at 16:05 +0100, Gavin Simpson wrote:
 Dear List,

 I'm having considerable trouble setting up my environment (Linux, Fedora
 16, Bash) to build and check packages under R Under Development
 (r61660). I'm doing this to better get a handle on difference in the
 output from running checks on examples in one of my packages. Note I
 compiled R Under Development myself

 The problem I am now having is whenever I try to build my analogue
 package using R Under Development, R complains about a dependency having
 been built before R 3.0.0. I obviously don't have my environment
 variables set correctly, but I don't see why or how R is finding my
 daily-use package library; if anything I would have expected it to fail
 with a missing dependency.

 If I start Rdevel with --vanilla (to mimic Rdevel CMD build) I see:

  .libPaths()
 [1] /home/gavin/R/devlibs /home/gavin/R/devel/build/library

 the first entry there is because I have temporarily set R_LIBS to that
 directory via export R_LIBS=/home/gavin/R/devlibs. From there we see I
 have versions of the dependencies installed in this library and they are
 built with 3.0.0:

  installed.packages(~/R/devlibs/)[, Built, drop = FALSE]
   Built
 analogue  3.0.0
 ctv   3.0.0
 permute   3.0.0
 princurve 3.0.0
 rgl   3.0.0
 scatterplot3d 3.0.0
 vegan 3.0.0

 Note that there are no other versions of vegan inadvertently installed
 to the build directory for R Under Development.

 Following advice in Writing R Extensions I have also created
 ~/build.Renviron and ~/check.Renviron and as these are non-standard I
 also followed the advice to set R_BUILD_ENVIRON and R_CHECK_ENVIRON
 again temporarily via export:

 $ cat $R_CHECK_ENVIRON
 R_LIBS=/home/gavin/R/devlibs

 $ cat $R_BUILD_ENVIRON
 R_LIBS=/home/gavin/R/devlibs

 Yet still I get errors building analogue:

 $ Rdevel CMD build ../analogue/pkg/
 * checking for file ‘../analogue/pkg/DESCRIPTION’ ... OK
 * preparing ‘analogue’:
 * checking DESCRIPTION meta-information ... OK
 * cleaning src
 * installing the package to re-build vignettes
   ---
 * installing *source* package ‘analogue’ ...
 ** libs
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 c_distx.c -o c_distx.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 c_distxy.c -o c_distxy.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 distx.c -o distx.o
 gcc -std=gnu99 -I/home/gavin/R/devel/build/include -DNDEBUG  
 -I/usr/local/include-fpic  -g -O2 -pipe -m64 -Wall 
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -march=core2 -fasynchronous-unwind-tables  -c 
 

Re: [Rd] Declaring/importing non-exported functions [car] in another package

2013-01-16 Thread Michael Friendly

On 1/16/2013 11:40 AM, Duncan Murdoch wrote:



2.  Is my only alternative to copy these functions to my package, also
unexported?


Using car:::df.terms explicitly is another option.

Another possibility is for the car maintainer (John Fox) to export 
that function from car.


Hmm.  It turns out that this is a bit more complicated, since 
car::df.terms is an S3 generic,

relying on car:::df.terms.default().

In my function, I am now using car::: explicitly--

# determine size of intervals [perhaps need importFrom(car, 
car:::df.terms, ...) in NAMESPACE?]

if(is.null(df)) {
  df - if (Scheffe) sum(car:::df.terms(object)) else 2
  }

However, when I removed the definitions of the subsidiary 
df.terms.default from my package, R CMD check

complains bitterly:

 coefplot(mod, add=TRUE, Scheffe=TRUE, fill=TRUE)
Error in UseMethod(df.terms) :
  no applicable method for 'df.terms' applied to an object of class 
c('mlm', 'lm')

Calls: coefplot - coefplot.mlm - Anonymous
Execution halted

So, the semantics of importFrom() do not allow non-exported functions (I 
still wonder why), and my only direct option is to

copy these functions to my package.

-Michael

--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.  Chair, Quantitative Methods
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

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


Re: [Rd] Declaring/importing non-exported functions [car] in another package

2013-01-16 Thread John Fox
Dear Duncan and Michael,

My initial reaction is that I'd rather not export these functions from the car 
package since the package already has many exported functions and the functions 
in question perform low-level operations that won't be of interest to end 
users. I recognize, however, the functions (and possibly some others) may be 
useful in other packages, such as heplots, so I'll think about this some more.

Following up on Michael's subsequent message in this thread, I find the current 
text in Sec. 1.6.1 (Specifying imports and exports) of Writing R Extensions 
reasonably clear.

Best,
 John

On Wed, 16 Jan 2013 11:40:37 -0500
 Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 13-01-16 11:25 AM, Michael Friendly wrote:
  A new function in my heplots package wants to use a non-exported utility
  function in the car package,
  df.terms, but this depends on other non-exported functions.
From the Writing R extensions manual, I thought I could do this via (in
  my NAMESPACE)
 
  importFrom(car, car:::df.terms, car:::df.terms.default, car:::is.aliased)
 
  but I get:
  ** preparing package for lazy loading
  Error : objects 'car:::df.terms', 'car:::df.terms.default',
  'car:::is.aliased' are not exported by 'namespace:car'
  ERROR: lazy loading failed for package 'heplots'
 
  \S 1.6.1 of the manual says regarding importFrom():
  Using |foo:::f| instead of |foo::f| allows access to unexported objects.
  This is generally not recommended, as the semantics of unexported
  objects may be changed by the package author in routine maintenance.
 
  Questions:
  1.  Why doesn't this work?
 
 I think you misread the manual.  It is talking about ways to access functions 
 other than by using importFrom.  You can use car:::df.terms in your functions.
 
  2.  Is my only alternative to copy these functions to my package, also
  unexported?
 
 Using car:::df.terms explicitly is another option.
 
 Another possibility is for the car maintainer (John Fox) to export that 
 function from car.
 
 Duncan Murdoch

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


Re: [Rd] Declaring/importing non-exported functions [car] in another package

2013-01-16 Thread Michael Friendly

On 1/16/2013 12:26 PM, John Fox wrote:

Dear Duncan and Michael,

My initial reaction is that I'd rather not export these functions from the car 
package since the package already has many exported functions and the functions 
in question perform low-level operations that won't be of interest to end 
users. I recognize, however, the functions (and possibly some others) may be 
useful in other packages, such as heplots, so I'll think about this some more.
This is why I wrote directly to R-devel rather than to you.  It is 
low-level, and doesn't need to be exported.
OTOH, it provides an elegant way to provide Sheffe-type intervals  
ellipses as you do in car::confidenceEllipse,

which I copied.

best,
-Michael



Following up on Michael's subsequent message in this thread, I find the current text in 
Sec. 1.6.1 (Specifying imports and exports) of Writing R Extensions 
reasonably clear.

Best,
  John

On Wed, 16 Jan 2013 11:40:37 -0500
  Duncan Murdoch murdoch.dun...@gmail.com wrote:

On 13-01-16 11:25 AM, Michael Friendly wrote:

A new function in my heplots package wants to use a non-exported utility
function in the car package,
df.terms, but this depends on other non-exported functions.
   From the Writing R extensions manual, I thought I could do this via (in
my NAMESPACE)

importFrom(car, car:::df.terms, car:::df.terms.default, car:::is.aliased)

but I get:
** preparing package for lazy loading
Error : objects 'car:::df.terms', 'car:::df.terms.default',
'car:::is.aliased' are not exported by 'namespace:car'
ERROR: lazy loading failed for package 'heplots'

\S 1.6.1 of the manual says regarding importFrom():
Using |foo:::f| instead of |foo::f| allows access to unexported objects.
This is generally not recommended, as the semantics of unexported
objects may be changed by the package author in routine maintenance.

Questions:
1.  Why doesn't this work?

I think you misread the manual.  It is talking about ways to access functions 
other than by using importFrom.  You can use car:::df.terms in your functions.


2.  Is my only alternative to copy these functions to my package, also
unexported?

Using car:::df.terms explicitly is another option.

Another possibility is for the car maintainer (John Fox) to export that 
function from car.

Duncan Murdoch



--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.  Chair, Quantitative Methods
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

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


[Rd] R CMD check not reading R_LIBS from ~/.R/check.Renviron

2013-01-16 Thread Gavin Simpson
Dear List,

Further to my earlier email, I note that, for me at least, R CMD check
is *not* reading R_LIBS from ~/.R/check.Renviron on R 2.15.2 patched
(r61228) and R Under Development (r61660). The only way I can get R CMD
check to look for packages in a user-supplied library is by explicitly
exporting R_LIBS set to the relevant directory.

R CMD build *does* read R_LIBS from ~/.R/build.Renviron for the same
versions of R on the same Fedora 16 laptop. So I am in the strange
situation of being able to build but not check a source package having
followed the instructions in Writing R Extensions.

I have tried exporting R_CHECK_ENVIRON via

export R_CHECK_ENVIRON=/home/gavin/.R/check.Renviron

and that doesn't work either.

~/.R/check.Renviron contains:

R_LIBS=/home/gavin/R/libs/
#R_LIBS=/home/gavin/R/devlibs/

Anyone suggest how/where I am going wrong?

More complete system info follows below.

TIA

Gavin

 sessionInfo()
R version 2.15.2 Patched (2012-12-05 r61228)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_GB.utf8   LC_NUMERIC=C 
 [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8
 [5] LC_MONETARY=en_GB.utf8LC_MESSAGES=en_GB.utf8   
 [7] LC_PAPER=CLC_NAME=C
 [9] LC_ADDRESS=C  LC_TELEPHONE=C   
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C  

attached base packages:
[1] stats graphics  grDevices utils datasets  methods  
[7] base 

 sessionInfo()
R Under development (unstable) (2013-01-16 r61660)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_GB.utf8   LC_NUMERIC=C 
 [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8
 [5] LC_MONETARY=en_GB.utf8LC_MESSAGES=en_GB.utf8   
 [7] LC_PAPER=CLC_NAME=C
 [9] LC_ADDRESS=C  LC_TELEPHONE=C   
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C  

attached base packages:
[1] stats graphics  grDevices utils datasets  methods  
[7] base
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [Rd] Trouble building package using R in development

2013-01-16 Thread Hadley Wickham
 To circumvent this, I check using:

 R --no-init-file CMD check foo_1.0.tar.gz

In devtools, we take considerable care to match the R you're running
with the R you're checking in, so we also set the following
environmental variables:

env - c(
LC_ALL = C,
R_LIBS = paste(.libPaths(), collapse = .Platform$path.sep),
CYGWIN = nodosfilewarning,
R_TESTS = ,
NOT_CRAN = true,
TAR = auto_tar(),
)

and always run /path/to/current/R --vanilla CMD check ...

Hadley

-- 
Chief Scientist, RStudio
http://had.co.nz/

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


Re: [Rd] Trouble building package using R in development

2013-01-16 Thread Gavin Simpson
On Wed, 2013-01-16 at 14:39 -0600, Hadley Wickham wrote:
  To circumvent this, I check using:
 
  R --no-init-file CMD check foo_1.0.tar.gz
 
 In devtools, we take considerable care to match the R you're running
 with the R you're checking in, so we also set the following
 environmental variables:
snip /

Thanks Henrik  Hadley,

 and always run /path/to/current/R --vanilla CMD check ...

To what end is the --vanilla here? Writing R Extensions says that R CMD
check (and R CMD build) are invoked via R --vanilla so that would seem
redundant, although my experience from several hours working this
through today suggests there is a difference between R --vanilla CMD
check and R CMD check.

G

 Hadley
 

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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