Re: [Rd] grid stringHeight

2011-05-02 Thread baptiste auguie
Hi,

I see, thanks. I incorrectly thought it used to produce the same
output in the past.
As a workaround I will wrap all strings in expression() before
evaluating the grobHeight; otherwise the calculated layout can clip
portions of the text.

Thanks,

baptiste

On 2 May 2011 15:00, Paul Murrell p.murr...@auckland.ac.nz wrote:
 Hi

 This is a basic feature of both strheight() and stringHeight().  They both
 ignore any descenders in the text.  I cannot remember why it was done this
 way originally.  The future solution is probably to add an argument that
 allows descenders to be included in text height.

 Plotmath works on bounding boxes so its behaviour is different, but of
 course that has its own problems because there is no sense of baseline for
 expressions.

 Paul

 On 27/04/2011 11:06 a.m., baptiste auguie wrote:

 Dear all,

 I'm puzzled by the behavior of stringHeight in the grid package.
 Consider the following test,

 library(grid)

 test- function(lab=dog, ...){
   g1- textGrob(lab)
   g2- rectGrob(height=grobHeight(g1), width=grobWidth(g1))
   gg- gTree(children=gList(g1,g2), ...)

   print(c(height:, convertUnit(stringHeight(lab), mm, y)))
   grid.draw(gg)
 }

 grid.newpage()
 test()
 test(expression(dog), vp=viewport(x=0.6))
 ## notice how the dog's tail is being cut off, where
 ## expression yields a snug cage

 grid.newpage()
 test(aoc)
 test(expression(aoc), vp=viewport(x=0.6))

 It appears that stringHeight correctly calculates the height for an
 expression, but not for a basic string. I think it used to produce the
 same output for both.

 Best regards,

 baptiste

 sessionInfo()
 R version 2.13.0 alpha (2011-03-27 r55076)
 Platform: i386-apple-darwin9.8.0 (32-bit)

 locale:
 [1] C

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

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

 --
 Dr Paul Murrell
 Department of Statistics
 The University of Auckland
 Private Bag 92019
 Auckland
 New Zealand
 64 9 3737599 x85392
 p...@stat.auckland.ac.nz
 http://www.stat.auckland.ac.nz/~paul/


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


Re: [Rd] R CMD build processes inst/doc/Makefile only if there are vignette files?

2011-05-02 Thread Hervé Pagès

On 11-04-29 10:36 PM, Prof Brian Ripley wrote:

On Fri, 29 Apr 2011, Hervé Pagès wrote:


On 11-03-30 01:55 AM, Prof Brian Ripley wrote:

What R CMD build (and check) does is to call tools::buildVignettes.
That has been true for a while, and buildVignettes() returns if no
vignettes are found. The docs are out-of-date.

My view is that you are misusing inst/doc: it is intended *only* for
files which are going to be installed and hence report.tex should not
really be there. So you should be doing this in another source directory
and copying report.pdf to inst/doc. Use configure to arrange this.

Shortly vignettes to be built will be moved out of inst/doc.


Could you please elaborate on this? I just found this in the NEWS for
R 2.14.0:

o The preferred location for vignette sources is now the directory
‘vignettes’ and not ‘inst/doc’: R CMD build will now re-build
vignettes in ‘vignettes’ and copy the ‘.Rnw’ (etc) files and
the corresponding PDFs to ‘inst/doc’.

Sounds like an important move. What are the long term plans: keep
both inst/doc/ and vignettes/ as places for vignettes to be built?
Or drop inst/doc/ at some point?


Drop inst/doc at some point.


May I ask when?


It doesn't make much difference to the
codebase: all the work is done in pkgVignettes().


Maybe but it will make a big difference from our side: about 450 BioC
packages will need to be modified.

Thanks,
H.






Thanks!
H.




On Tue, 29 Mar 2011, Henrik Bengtsson wrote:


Hi,

in Section 'Writing package vignettes' of 'Writing R Extensions' it
says:

Whenever a Makefile is found, then R CMD build will try to run make
after the Sweave runs, so PDF manuals can be created from arbitrary
source formats (plain LaTeX files, ...). [...] Note that the make step
is executed even if there are no files in Sweave format, [...].

In my package, inst/doc/ file contains two files: Makefile, and
report.tex. However, when running 'Rcmd build' on Windows with R
v2.13.0 alpha (2011-03-27 r55091) I can only get 'make' to run
(process inst/doc/Makefile) if I add a inst/doc/dummy.Rnw file,
otherwise nothing happens. My Makefile contains:

all: pdf

pdf: report.tex
texi2dvi --pdf report.tex

clean:
rm dummy.Rnw dummy.tex
rm *.aux *.log *.toc

Is it really necessary to add dummy.Rnw? Am I missing something?

/Henrik


sessionInfo()

R version 2.13.0 alpha (2011-03-27 r55091)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

loaded via a namespace (and not attached):
[1] tools_2.13.0

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






--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fhcrc.org
Phone: (206) 667-5791
Fax: (206) 667-1319






--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fhcrc.org
Phone:  (206) 667-5791
Fax:(206) 667-1319

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


[Rd] Using substitute to access the expression related to a promise

2011-05-02 Thread Hadley Wickham
Hi all,

The help for delayedAssign suggests that you can use substitute to
access the expression associated with a promise, and the help for
substitute says: If it is a promise object, i.e., a formal argument
to a function or explicitly created using ‘delayedAssign()’, the
expression slot of the promise replaces the symbol.

But this doesn't seem to work:

 a - 1
 b - 2
 delayedAssign(x, {message(assigning...); a + b})
 substitute(x)
x
 x
[1] 3

Is this a bug in substitute?

 sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
...

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

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


Re: [Rd] Using substitute to access the expression related to a promise

2011-05-02 Thread Gabor Grothendieck
On Mon, May 2, 2011 at 9:53 AM, Hadley Wickham had...@rice.edu wrote:
 Hi all,

 The help for delayedAssign suggests that you can use substitute to
 access the expression associated with a promise, and the help for
 substitute says: If it is a promise object, i.e., a formal argument
 to a function or explicitly created using ‘delayedAssign()’, the
 expression slot of the promise replaces the symbol.

 But this doesn't seem to work:

 a - 1
 b - 2
 delayedAssign(x, {message(assigning...); a + b})
 substitute(x)
 x
 x
 [1] 3

 Is this a bug in substitute?

 sessionInfo()
 R version 2.13.0 (2011-04-13)
 Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

It works differently if the assign environment is the global
environment or not.  This is actually mentioned on the help page for
substitute though its precise meaning may not be completely clear from
the wording.

Try this:

 e - new.env()
 delayedAssign(x, {message(assigning...); a + b},, e)
 substitute(x, e)
{
message(assigning...)
a + b
}



-- 
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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


Re: [Rd] Using substitute to access the expression related to a promise

2011-05-02 Thread Duncan Murdoch

On 02/05/2011 9:53 AM, Hadley Wickham wrote:

Hi all,

The help for delayedAssign suggests that you can use substitute to
access the expression associated with a promise, and the help for
substitute says: If it is a promise object, i.e., a formal argument
to a function or explicitly created using ‘delayedAssign()’, the
expression slot of the promise replaces the symbol.

But this doesn't seem to work:

  a- 1
  b- 2
  delayedAssign(x, {message(assigning...); a + b})
  substitute(x)
x
  x
[1] 3

Is this a bug in substitute?



I think it is a design flaw rather than a bug:  the global environment 
is handled specially.  If you put those lines into a function you'll see 
different behaviour.  I think if you really carefully read the 
documentation you'll find it says this.


I suggested regularizing this several years ago, but there were worries 
that it would break some common usage.


Duncan Murdoch


  sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
...

Hadley



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


Re: [Rd] Using substitute to access the expression related to a promise

2011-05-02 Thread Gabor Grothendieck
On Mon, May 2, 2011 at 10:10 AM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
 On 02/05/2011 9:53 AM, Hadley Wickham wrote:

 Hi all,

 The help for delayedAssign suggests that you can use substitute to
 access the expression associated with a promise, and the help for
 substitute says: If it is a promise object, i.e., a formal argument
 to a function or explicitly created using ‘delayedAssign()’, the
 expression slot of the promise replaces the symbol.

 But this doesn't seem to work:

   a- 1
   b- 2
   delayedAssign(x, {message(assigning...); a + b})
   substitute(x)
 x
   x
 [1] 3

 Is this a bug in substitute?


 I think it is a design flaw rather than a bug:  the global environment is
 handled specially.  If you put those lines into a function you'll see
 different behaviour.  I think if you really carefully read the documentation
 you'll find it says this.

 I suggested regularizing this several years ago, but there were worries that
 it would break some common usage.

 Duncan Murdoch

Perhaps an argument could be added to indicate whether the global
environment was treated specially or not.  If it defaulted to the
current behavior it would still be backwardly compatible.

The other limitation that I have come across here is the asymmetry of
being able to extract the data of the promise but not the environment.
 Being able to copy a promise without evaluating it is another
operation that would be nice.   Currently one can only do these two
things at the C level.

-- 
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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


Re: [Rd] Using substitute to access the expression related to a promise

2011-05-02 Thread Hadley Wickham
On Mon, May 2, 2011 at 9:10 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 02/05/2011 9:53 AM, Hadley Wickham wrote:

 Hi all,

 The help for delayedAssign suggests that you can use substitute to
 access the expression associated with a promise, and the help for
 substitute says: If it is a promise object, i.e., a formal argument
 to a function or explicitly created using ‘delayedAssign()’, the
 expression slot of the promise replaces the symbol.

 But this doesn't seem to work:

   a- 1
   b- 2
   delayedAssign(x, {message(assigning...); a + b})
   substitute(x)
 x
   x
 [1] 3

 Is this a bug in substitute?


 I think it is a design flaw rather than a bug:  the global environment is
 handled specially.  If you put those lines into a function you'll see
 different behaviour.  I think if you really carefully read the documentation
 you'll find it says this.

I guess you mean this sentence: If it is an ordinary variable, its
value is substituted, unless ‘env’ is ‘.GlobalEnv’ in which case the
symbol is left unchanged.  But I think the conditioning is confusing,
because it implies that this condition only comes into play if x is an
ordinary variable, which is not the case in my example.

Hadley



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

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


[Rd] R 2.13 segfault with range()

2011-05-02 Thread Terry Therneau
Running on a shared CENTOS server

tmt711% R --vanilla

R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

 sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C  
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=C  
 [5] LC_MONETARY=C  LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C 
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C   

attached base packages:
[1] stats graphics  grDevices utils datasets  methods
base 
 load('test.rda')
 y - matrix(ifelse(tdata$dataset=0, NA, tdata$dataset), 
+ ncol=ncol(tdata$dataset))
 dim(y)
[1] 2228335
 range(y)

 *** caught segfault ***
address 0x2b490421f000, cause 'memory not mapped'

Traceback:
 1: range(y)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 3

tmt712% ls -s test.rda
2664 test.rda

-
  
  The data set is too large to attach, but I can send the test.rda file
off list.  The data is not confidential.

Terry Therneau

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


[Rd] Replacing '.self' with an .Rda image of '.self' from within a method?

2011-05-02 Thread Janko Thyson

Dear list,

Is it possible to update or reassign '.self' with an image of '.self' 
(e.g. a locally stored .Rda file) from within a method?


I know that this might sound akward, but here's the use case:
1) Ref Class Definition
setRefClass(Class=Test,
fields=list(A=character, B=character),
methods=list(importImage=function(path){
variable - load(path)
expr - paste(assign(', variable, ',, variable, , 
envir=.self), sep=)

eval(parse(text=expr))
}
)
2) Initialize Method Definition
setMethod(
f=initialize,
signature=signature(.Object=Test),
definition=function(
.Object,
path=NULL
){
obj - callNextMethod(.Object)
if(!is.null(path){
obj$importImage(path=path)
}
return(obj)
}
3) Intended and Extended Use
Method 'importImage' was originally intended to read either an 
object of name 'A' or 'B' from a respective path and overwrite the 
respective fields in an obj of class 'Test'.
Now I wondered how I could reassign/update the object of class 
'Test' itself by reading a respective .Rda image of an object of class 
'Test' from within 'obj$importImage()'.
The way I've written 'importImage()', it did not work. Yet I wonder 
if it's possible.

4) My Workaround (but I'm looking for something more elegantly)
In the class definition:
[...]
methods=list(importImage=function(path){
variable - load(path)
if(variable != .self){
expr - paste(assign(', variable, ',, variable, , 
envir=.self), sep=)

eval(parse(text=expr))
return(TRUE)
} else {
return(.self)
}
})
[...]

In the initialize method:
setMethod(
f=initialize,
signature=signature(.Object=Test),
definition=function(
.Object,
path=NULL
){
obj - callNextMethod(.Object)
if(!is.null(path){
rslt - obj$importImage(path=path)
if(!is.logical(rslt)){
obj - rslt
}
}
return(obj)
}

Thanks for any comments,
Janko

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


[Rd] raw connections: reading does not alter current position pointer

2011-05-02 Thread William Dunlap
Am I misunderstanding rawConnections here or are
rawConnections not working right yet?  It looks
like I can use seek() to position the read pointer
but readBin does not position the read pointer past
what has just been read.

   myRawTen - as.raw(101:110)
   str(myRawTen)
   raw [1:10] 65 66 67 68 ...
   rawToChar(myRawTen)
  [1] efghijklmn
   myRawTenCon - rawConnection(myRawTen)
   readBin(myRawTenCon, what=integer, size=2, n=1)
  [1] 26213
   c(26213%%256, 26213%/%256)
  [1] 101 102
   # next 2-byte integer should be 104*256 + 103 = 26727
   readBin(myRawTenCon, what=integer, size=2, n=1)
  [1] 26213
   # if I seek() explicitly it works
   seek(myRawTenCon, 2)
  [1] 6
   readBin(myRawTenCon, what=integer, size=2, n=1)
  [1] 26727
  
   seek(myRawTenCon, 6) # look at last 4 bytes: 107:110
  [1] 0
   # multiple reads in one call to readBin do not advance
   # the position pointer:
   readBin(myRawTenCon, what=integer, size=1, n=4)
  [1] 107 107 107 107

   sessionInfo()
  R version 2.13.0 (2011-04-13)
  Platform: i386-pc-mingw32/i386 (32-bit)

  locale:
  [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252LC_MONETARY=English_United States.1252
  [4] LC_NUMERIC=C   LC_TIME=English_United
States.1252

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


  other attached packages:
  [1] lattice_0.19-23 MASS_7.3-12

  loaded via a namespace (and not attached):
  [1] compiler_2.13.0 grid_2.13.0 tools_2.13.0   

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

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


[Rd] Source for bash_completion.d/R?

2011-05-02 Thread Sharpie
Hello, I was just tweaking the R build for the Homebrew package manager and I
thought it would be nice to enable bash completion. I noticed that
Debian-based systems install `/etc/bash_completion.d/R` but could not find a
source for this file in the `etc` folder of the R source.

Is the R bash completion script publicly available somewhere so that it
could be pulled in by curl?

-
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
--
View this message in context: 
http://r.789695.n4.nabble.com/Source-for-bash-completion-d-R-tp3490662p3490662.html
Sent from the R devel mailing list archive at Nabble.com.

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


Re: [Rd] R CMD check and Suggests Packages

2011-05-02 Thread Hervé Pagès

Hi,

On 11-04-28 07:00 PM, Dario Strbenac wrote:

Hello,

In my description file, I have an example data package in Suggests: that I've 
deleted from my library to test what the user who doesn't have it will 
experience.

However, R CMD check won't even pass my package :

* checking package dependencies ... ERROR
Package required but not available: RepitoolsExamples

  
 confusing!

Wouldn't a message like

  Package required for full checking but not available: RepitoolsExamples

be more appropriate and avoid a confusion that we've seen
for a very long time now?

Just me 2 cents...

Cheers,
H.



Why would it have to be installed, if it's only a data package, that isn't needed in any 
of my code ? The manual also says In particular, large packages providing “only” 
data for examples or vignettes should be listed in ‘Suggests’ rather than ‘Depends’ in 
order to make lean installations possible.

--
Dario Strbenac
Research Assistant
Cancer Epigenetics
Garvan Institute of Medical Research
Darlinghurst NSW 2010
Australia
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fhcrc.org
Phone:  (206) 667-5791
Fax:(206) 667-1319

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


[Rd] Capturing the expression representing the body of a function

2011-05-02 Thread Hadley Wickham
Hi all,

What's the preferred way of capturing the expression representing the
contents of a function?

* body(write.csv) gives me a braced expression
* body(write.csv)[-1] gives me a mangled call
* as.list(body(write.csv)[-1]) gives me a list of calls
* as.expression(as.list(body(write.csv)[-1])) is what I want but seems
like too much work

Any suggestions?

Thanks,

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

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


Re: [Rd] How to create vignette.pdf for R-2.13.0?

2011-05-02 Thread cstrato

Dear Prof. Ripley,

Thank you for your confirmation and explanation, I understand the reason 
for cleaning things up to save memory. However, it was very convenient 
to have this feature in earlier versions of R. It would be really 
helpful to have an additional option to R CMD check, e.g. 
--no-clean-vignettes.


FYI, I did not claim ..create the vignettes *in pkginst/doc*, 
instead my words were:
One interesting observation is that xps.Rcheck from R-2.12.2 contains 
the subdirectory inst/doc with the vignettes while xps.Rcheck from 
R-2.13.0 does not contain inst.


Best regards
Christian
_._._._._._._._._._._._._._._._._._
C.h.r.i.s.t.i.a.n   S.t.r.a.t.o.w.a
V.i.e.n.n.a   A.u.s.t.r.i.a
e.m.a.i.l:cstrato at aon.at
_._._._._._._._._._._._._._._._._._


On 5/2/11 7:08 AM, Prof Brian Ripley wrote:

On Sun, 1 May 2011, Duncan Murdoch wrote:


On 11-05-01 4:10 PM, cstrato wrote:

Dear Duncan, dear Uwe,

Since I have installed both WinXP and OpenSUSE 11.3 on my Mac in a
virtual machine, I have now done the following tests on all three
architectures:

1, R CMD build xps:
This creates xps_1.13.1.tar.gz which DOES contain all vignettes as
pdf-file. Thus R CMD build is ok.

2, R CMD check xps:
This does NOT build the vignettes as pdf-files on all three
architectures. Or to be more precise, R-2.13.0 does no longer build the
vignettes since with R-2.12.2 and earlier versions R did create the
vignettes as pdf-files.

Thus the question is:
Why does R CMD check no longer create the vignettes?


Probably the answer is simply because it doesn't. For a truly
reliable check, you should build the package, then check the tar.gz
file. Anything else is, and always has been, an approximation.


Actually, it does. What earlier versions never did (despite 'cstrato's
repeated delusional claims earlier) was to create the vignettes *in
pkginst/doc*. All of them re-created (by default) vignettes in a
working directory. The difference is that 2.13.0 deletes that working
directory if the test was successful, whereas earlier versions left the
results somewhere in pkg.Rcheck (the 'somewhere' has varied). However,
earier versions of R CMD check sometimes failed when R CMD build succeeded

Using Animal (a small CRAN package with one vignette).

R 2.12.2 gave

* checking package vignettes in ‘inst/doc’ ... WARNING
Package vignettes without corresponding PDF:
/tmp/Animal/inst/doc/Animal.Rnw

and the vignette was re-created in Animal.Rcheck/inst/doc.

R 2.13.0 gives

* checking package vignettes in ‘inst/doc’ ... WARNING
Package vignette(s) without corresponding PDF:
Animal.Rnw

Non-ASCII package vignette(s) without specified encoding:
Animal.Rnw

* checking running R code from vignettes ... OK
* checking re-building of vignettes ... OK

and the working directory was Animal.Rcheck/vign_test .

The main reason for cleaning up is that to mimic R CMD build the test
has to make a complete copy of the package sources, and that adds up:
checking CRAN already takes 17GB for each flavour.




Duncan Murdoch




Best regards
Christian


On 4/27/11 10:16 AM, Uwe Ligges wrote:



On 26.04.2011 21:58, cstrato wrote:

Dear Duncan, dear Uwe,

Just now I have re-run everything, and today xps.Rnw can be
converted to
a vignette w/o any problems using:
a, buildVignettes(xps, dir=/Volumes/CoreData/CRAN/xps, quiet=F)
b, R CMD Sweave xps.Rnw

In both cases the vignette xps.pdf is created (maybe my Mac did not
like
to work during eastern holidays).

However, one issue remains:
R64 CMD check xps_1.13.1.tar.gz no longer creates any pdf files for
the vignettes.



Dioes it give an error or warning? It should check the code. R CMD
build
creates the pdf files.

Uwe Ligges



Best regards
Christian


On 4/25/11 9:31 PM, Duncan Murdoch wrote:

On 25/04/2011 3:16 PM, cstrato wrote:

Thank you.

My problem seems to be that at the moment the problem can be seen
only
on my Mac, since e.g. the Bioconductor servers have no problems
creating
the vignettes.


Then you are definitely the one in the best position to diagnose the
problem. Use the usual approach: simplify it by cutting out
everything
that looks unrelated. Verify that the problem still exists, then cut
some more. Eventually you'll have isolated the error to a particular
small snippet of code, and then you can add print() statements, or
use
trace(), or do whatever is necessary to see what's so special
about your
system.

I suspect it will turn out to be an assumption in the code that is
not
true on your system.

If the assumption is being made by code you wrote, then fix it. If
it's
being made by R, let us know.

Duncan Murdoch



Best regards
Christian

On 4/25/11 8:55 PM, Duncan Murdoch wrote:

cstrato wrote:

Dear Duncan,

Thank you for your example, however it is different since it
does not
use x and y. What about print(x+y)?


Try it.



Sorry, I do not believe that there is a bug in my code, since:
1, it worked in all versions from R starting with R-2.6.0 till
R-2.12.2.
2, the identical code 

Re: [Rd] Capturing the expression representing the body of a function

2011-05-02 Thread Duncan Murdoch

On 02/05/2011 3:21 PM, Hadley Wickham wrote:

Hi all,

What's the preferred way of capturing the expression representing the
contents of a function?

* body(write.csv) gives me a braced expression
* body(write.csv)[-1] gives me a mangled call
* as.list(body(write.csv)[-1]) gives me a list of calls
* as.expression(as.list(body(write.csv)[-1])) is what I want but seems
like too much work

Any suggestions?


The body of a function isn't an expression, it's a language object.  A 
language object is represented internally as a pairlist, while an 
expression is represented as a generic vector, i.e. the thing that 
list() gives.


Your 1st try gives you the language object.

The other ones only work when the body consists of a call to `{`, as the 
body of most complex functions does, but not for simple ones like


f - function(x) 2*x

So I would say your question should be:  What's the best way to 
construct an expression vector s.t. evaluating its elements in order is 
like evaluating the body of a function?


And the answer to that is something like

body2expr - function(f) {
  body - body(f)
  if (typeof(body) == language  identical(body[[1]], quote(`{`))) 
as.expression(as.list(body[-1]))

  else as.expression(body)
}

Duncan Murdoch

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


Re: [Rd] Capturing the expression representing the body of a function

2011-05-02 Thread Gabor Grothendieck
On Mon, May 2, 2011 at 4:11 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 02/05/2011 3:21 PM, Hadley Wickham wrote:

 Hi all,

 What's the preferred way of capturing the expression representing the
 contents of a function?

 * body(write.csv) gives me a braced expression
 * body(write.csv)[-1] gives me a mangled call
 * as.list(body(write.csv)[-1]) gives me a list of calls
 * as.expression(as.list(body(write.csv)[-1])) is what I want but seems
 like too much work

 Any suggestions?

 The body of a function isn't an expression, it's a language object.  A
 language object is represented internally as a pairlist, while an expression
 is represented as a generic vector, i.e. the thing that list() gives.

 Your 1st try gives you the language object.

 The other ones only work when the body consists of a call to `{`, as the
 body of most complex functions does, but not for simple ones like

 f - function(x) 2*x

 So I would say your question should be:  What's the best way to construct
 an expression vector s.t. evaluating its elements in order is like
 evaluating the body of a function?

 And the answer to that is something like

 body2expr - function(f) {
  body - body(f)
  if (typeof(body) == language  identical(body[[1]], quote(`{`)))
 as.expression(as.list(body[-1]))
  else as.expression(body)
 }



Also try as.expression(as.list(f)[[3]])

e.g.

 f - function(x, y) { x + y }
 as.expression(as.list(f)[[3]])
expression({
x + y
})
 g - function(x, y) x + y
 as.expression(as.list(g)[[3]])
expression(x + y)




-- 
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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


Re: [Rd] Capturing the expression representing the body of a function

2011-05-02 Thread Hadley Wickham
 The body of a function isn't an expression, it's a language object.  A
 language object is represented internally as a pairlist, while an expression
 is represented as a generic vector, i.e. the thing that list() gives.

That doesn't agree with the documentation of is.language which implies
a language object is a ‘name’, a ‘call’, or an ‘expression’, and
doesn't mention pairlist anywhere.

 Your 1st try gives you the language object.

It gives me a call, doesn't it?  And the documentation for body
implies that this special type of call is called a bracketed
expression (despite it not being an expression as defined in the
documentation for expression)

(I don't mean to be nit-picky, I'm just trying to understand what's going on)

 So I would say your question should be:  What's the best way to construct
 an expression vector s.t. evaluating its elements in order is like
 evaluating the body of a function?

 And the answer to that is something like

 body2expr - function(f) {
  body - body(f)
  if (typeof(body) == language  identical(body[[1]], quote(`{`)))
 as.expression(as.list(body[-1]))
  else as.expression(body)
 }

Ok, thanks.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

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


Re: [Rd] Source for bash_completion.d/R?

2011-05-02 Thread Dirk Eddelbuettel

On 2 May 2011 at 11:32, Sharpie wrote:
| Hello, I was just tweaking the R build for the Homebrew package manager and I
| thought it would be nice to enable bash completion. I noticed that
| Debian-based systems install `/etc/bash_completion.d/R` but could not find a
| source for this file in the `etc` folder of the R source.

Right. This started off via a suggestion by Deepayan and a quick install via
a local-to-Debian-package-sources file, and has never moved away from that.

I am CCing Deepayan now; it may indeed be useful to commit this in the R svn
and to add it to the tarball as the feature is very, very useful if you
deplay bash completion.
 
Dirk

-- 
Gauss once played himself in a zero-sum game and won $50.
  -- #11 at http://www.gaussfacts.com

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