Re: [Rd] Surprising behavior of Negate()

2010-08-30 Thread Peter Dalgaard
On 08/30/2010 02:01 AM, Olaf Mersmann wrote:
 This matches 'f' when Negate() is called and not the first time the return
 value is used. If the current behavior is desired, maybe a note in the
 documentation could be added to clarify this peculiarity.

Looks like a classic lazy eval gotcha -- almost never intentional.

Testing your patch now.

-p

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


[Rd] S4 Method Rd Warning

2010-08-30 Thread Dario Strbenac
Hello,

I am using R 2.11.0. I have a curious problem where I get a warning in R CMD 
check which is seemingly not relevant to my Rd file.

The warning says :

* checking Rd \usage sections ... WARNING
Bad \usage lines found in documentation object 'enrichmentCalc':
unescaped bkslS4method{enrichmentCalc}{GenomeDataList, BSgenome}(rs, 
organism, seqLen=NULL, ...)
unescaped bkslS4method{enrichmentCalc}{GenomeData, BSgenome}(rs, 
organism, seqLen=NULL, do.warn=FALSE)
unescaped bkslS4method{enrichmentCalc}{GRanges, BSgenome}(rs, organism, 
seqLen=NULL)

Functions with \usage entries need to have the appropriate \alias entries,
and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See the chapter 'Writing R documentation files' in manual 'Writing R
Extensions'.

But, I have documented all the arguments, and I have all the aliases. What else 
could it be warning me about ?

The Rd file contents are :

\name{enrichmentCalc}
\alias{enrichmentCalc}
\alias{enrichmentCalc,GenomeDataList,BSgenome-method}
\alias{enrichmentCalc,GenomeData,BSgenome-method}
\alias{enrichmentCalc,GRanges,BSgenome-method}

\title{Calculate sequencing enrichment}
\description{A description}
\usage{
  \S4method{enrichmentCalc}{GenomeDataList, BSgenome}(rs, organism, 
seqLen=NULL, ...)
  \S4method{enrichmentCalc}{GenomeData, BSgenome}(rs, organism, seqLen=NULL, 
do.warn=FALSE)
  \S4method{enrichmentCalc}{GRanges, BSgenome}(rs, organism, seqLen=NULL)
}
\arguments{
  \item{rs}{jjj}
  \item{organism}{ghi}
  \item{seqLen}{def}
  \item{do.warn}{abc}
  \item{...}{xyz}
}
\details{
  Details.
}
\value{
 Text here.
}
\author{A Person}
\examples{
 #See the manual
}

Thanks,
   Dario.

--
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


Re: [Rd] No [[-.factor()

2010-08-30 Thread Martin Maechler
 Prof Brian Ripley rip...@stats.ox.ac.uk
 on Mon, 30 Aug 2010 08:28:24 +0100 (BST) writes:

 On Thu, 26 Aug 2010, Martin Maechler wrote:
 WD == William Dunlap wdun...@tibco.com
 on Wed, 25 Aug 2010 17:31:27 -0700 writes:
 
WD Should there be a [[-.factor() that either throws
WD an error or acts like [-.factor() to avoid making
WD an illegal object of class factor?
 
 Yes, one or the other.
 Note that both `[-` and `[[-` are Primitive and do some
 informal dispatch in addition to the formal method dispatch,

 I don't think so.  do_subassign2 does formal method dispatch, albeit 
 internally, but nothing else (do_assign2_dflt selects only by 
 typeof()).

One consider that as an informal dispatch, notably
distinguishing lists and atomics...

 so there's no need for an explicit '[[-.factor' method definition.
 For factors, it seems rational and expectable that
 double bracket behaves as single bracket when *one* element is
 assigned.
 z[[2:3]] - c(Two, Three)
 however  should continue to give an error.

 I added a [[-.factor yesterday.  Note that we do have a [-.factor 
 which works on the integer codes, and I simply copied its logic.

thank you!

 BTW, you probably meant

 z[[2:3]] - c(Two, Three)

yes, indeed!
Martin



  z - factor(c(Two,Two,Three), levels=c(One,Two,Three))
  z
WD [1] Two   Two   Three
WD Levels: One Two Three
  str(z)
WD Factor w/ 3 levels One,Two,Three: 2 2 3
  z[[2]] - One
  str(z) # the .Data part is now character
WD Factor w/ 3 levels One,Two,Three: 2 One 3
  z
WD [1] NA NA NA
WD Levels: One Two Three
  z[2] - One
WD Error in class(x) - cx : adding class factor to an invalid object
 
WD Bill Dunlap
WD Spotfire, TIBCO Software
WD wdunlap tibco.com

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


Re: [Rd] NEWS and readNEWS

2010-08-30 Thread Hadley Wickham
   * s.post -  SERIES NEWS
   * s.pre - ^[\t ]*CHANGES IN R VERSION 

 Is this a bug or is the documentation incorrect?

 readNEWS() is really for such 3-level files, but then R itself will move
 to an 2-level Rd format in R 2.12.0.

 Use news() to read package news files.

Ah, ok, this is rather unclear from the current documentation.  So if
I want to read a NEWS file off disk to check that I have the right
format (without installing the package first), I should use
tools:::.build_news_db ?

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] Does anyone use Sweave (RweaveLatex) option expand=FALSE?

2010-08-30 Thread Duncan Murdoch

On 19/08/2010 5:25 PM, Duncan Murdoch wrote:

On 19/08/2010 5:07 PM, Kevin Coombes wrote:
 I use it, frequently. The idea for it goes back to some of Knuth's 
 original literate programming ideas for developing weave and tangle when 
 he was writing TeX (the program).  I want to be able to document the 
 pieces of some complex algorithm without having to see all of the gory 
 details.  For instance, I have code that looks like the following.  
 (Note that this is typed on the fly rather than copied from actual 
 source, so there may be typos.)


Okay, thanks.  I'll keep it in.  So now I have a question:  suppose
you have an error (syntax error at this point, maybe some other kinds of 
error in the future) in the getInfoAboutThisSample chunk, but that 
chunk wasn't eval'd, mainloop was eval'd.  So the error is going to be 
reported as occurring in chunk mainloop, but with a line number from 
somewhere else in the file.  Is that a problem?
  


I was out of town for a week, but I'm back now, and have just committed 
these changes.  Hopefully the reports of syntax errors will be a little 
more helpful now.  I don't think I'll have time to make the reports of 
execution time errors better before the 2.12.0 release.


Duncan Murdoch


Duncan Murdoch


 
 mainloop,keep.source=TRUE,expand=FALSE=

 for (i in 1:nSamples) {
 getInfoAboutThisSample
  for (j in 1:nChromosomes) {
 getChromosomeDataForCurrentSample
 normalizeChromosomeData
 findSegments
 computeSignificance
 writeResults
  }
 }
 @
 
 Each of the chunks is itself a fairly long piece of code defined and 
 documented somewhere else.  (Some of them may themselves be written in 
 the same form to reduce the final size of a chunk to something a human 
 has a chance of understanding. That's the difference between weave and 
 tangle in the original implementation.)   By blocking expansion, I can 
 focus on the main steps without having them lost in pages and pages of code.
 
 So I vote strongly for retaining expand=FALSE.
 
 Best,

 Kevin
 
 Duncan Murdoch wrote:

 On 19/08/2010 4:29 PM, Claudia Beleites wrote:
 I never used it.

 I got curious, though. What would be a situation that benefits of 
 this option?
   
 When I put it in, I thought it would be for people who were writing 
 about Sweave.


 Duncan Murdoch

 Maybe a use case could be found by brute force (grep all .Rnw files 
 on CRAN for the option?


 Claudia


 __
 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] introspective capabilities

2010-08-30 Thread Duncan Murdoch

On 27/08/2010 7:52 AM, Christophe Rhodes wrote:

Hi,

Is there any way, from R code, to perform introspection as to where
certain names acquired their values?  The specific functionality I'm
looking for in this case is to be able to request my editor to view the
definition corresponding to a name in its original source location
(presuming for the moment that that location exists).  Other
functionality that I'm looking for is to identify where in the current
image a particular name is used -- what functions use the value bound
to a particular name?

The context for these questions, in case anyone is interested, is that I
am usually a Common Lisp programmer, and my programming environment for
that (SLIME) is what I'm used to.  R is sufficiently close to CL (the
discovery of withCallingHandlers/withRestarts was a pleasant surprise)
that I decided to experiment with implementing a SLIME backend for R --
and enough of it seems to work that I'm motivated to make it more
complete.  (The current state of the project is summarised at
http://common-lisp.net/~crhodes/swankr/).

  
There's the keep.source option to source() and the optional srcfile 
argument to parse() that tell R to keep this information.  If you 
haven't changed the default
getOption(keep.source) from TRUE, then source will default to keeping 
it, and you can find the original location of a function definition for 
function f by looking in attr(body(f), srcref).  See ?srcref for the 
format; there aren't a lot of user-level utility functions for working 
with this.


For packages, the relevant option is keep.source.pkgs at the time the 
package is installed.


Duncan Murdoch

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


[Rd] R with multiple processors

2010-08-30 Thread Michel Boaventura
Hello,

I was taking a look at R code, and there is some places that should be
easily parallelized, as the dist() function, for example.

Is there an interest on do such thing on R? I would like to start making
patches to parallelize, but how comfortable with this are the main
developers team on R?

Best regards,

Michel

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