Re: [Rd] Code tools for identifying which package A functions package B use?

2014-11-14 Thread Henrik Bengtsson
Thanks Kasper, that seems to do it:

$ url=https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/codetoolsBioC
$ svn checkout --username readonly --password readonly $url
$ R CMD build codetoolsBioC
$ R CMD INSTALL codetoolsBioC
$ R

> library("codetoolsBioC")
> deps <- findExternalDeps("MASS")
attaching required packages 'MASS'
Loading required package: MASS
> str(deps)
List of 4
 $ S4Classes: list()
 $ S4Methods:List of 1
  ..$ methods: chr "body<-"
 $ functions:List of 5
  ..$ base : chr [1:248] "-" "!" "!=" "$" ...
  ..$ graphics : chr [1:16] "abline" "axis" "box" "frame" ...
  ..$ grDevices: chr [1:5] "dev.flush" "dev.hold" "nclass.FD" ...
  ..$ methods  : chr "new"
  ..$ stats: chr [1:97] ".checkMFClasses" ".getXlevels" ...
 $ variables:List of 1
  ..$ base: chr [1:4] ".GlobalEnv" ".Machine" ".Options" "pi"
>

Great!

/Henrik

On Fri, Nov 14, 2014 at 8:41 PM, Kasper Daniel Hansen
 wrote:
> The best thing I have found is codetoolsBioC in the Bioconductor subversion
> repository.
>
> Best,
> Kasper
>
> On Fri, Nov 14, 2014 at 9:57 PM, Henrik Bengtsson 
> wrote:
>>
>> Hi,
>>
>> I'd like to list all package PkgA functions that another package PkgB
>> use via Depends or Imports (ignoring Suggests for simplicity).  As
>> long as PkgB uses importFrom("PkgA", ...) it's just a matter of
>> parsing the NAMESPACE file or inspecting
>> asNamespace("PkgB")$.__NAMESPACE__.$imports.  However, what can be
>> done in case PkgB uses import("PkgA")?  Is there a function/package
>> already available for this?
>>
>> Thanks,
>>
>> Henrik
>>
>> __
>> 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] Code tools for identifying which package A functions package B use?

2014-11-14 Thread Kasper Daniel Hansen
The best thing I have found is codetoolsBioC in the Bioconductor subversion
repository.

Best,
Kasper

On Fri, Nov 14, 2014 at 9:57 PM, Henrik Bengtsson 
wrote:

> Hi,
>
> I'd like to list all package PkgA functions that another package PkgB
> use via Depends or Imports (ignoring Suggests for simplicity).  As
> long as PkgB uses importFrom("PkgA", ...) it's just a matter of
> parsing the NAMESPACE file or inspecting
> asNamespace("PkgB")$.__NAMESPACE__.$imports.  However, what can be
> done in case PkgB uses import("PkgA")?  Is there a function/package
> already available for this?
>
> Thanks,
>
> Henrik
>
> __
> 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] Code tools for identifying which package A functions package B use?

2014-11-14 Thread Henrik Bengtsson
Hi,

I'd like to list all package PkgA functions that another package PkgB
use via Depends or Imports (ignoring Suggests for simplicity).  As
long as PkgB uses importFrom("PkgA", ...) it's just a matter of
parsing the NAMESPACE file or inspecting
asNamespace("PkgB")$.__NAMESPACE__.$imports.  However, what can be
done in case PkgB uses import("PkgA")?  Is there a function/package
already available for this?

Thanks,

Henrik

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


[Rd] Error "promise already under evaluation ..." with function(x, dim=dim(x))

2014-11-14 Thread Henrik Bengtsson
I've meant to ask the following for several years now.  I understand why:

> foo <- function(x, dim=dim) { dim }
> foo(1)
Error in foo(1) :
  promise already under evaluation: recursive default argument
reference or earlier problems?

gives an error, but why wouldn't/couldn't the following work?

> foo <- function(x, dim=dim(x)) { dim }
> foo(1)
Error in foo(1) :
  promise already under evaluation: recursive default argument
reference or earlier problems?

As a workaround I also tried:

> foo <- function(x, dim) { if (missing(dim)) dim <- dim(x); dim }
> foo(1)
Error in foo(1) : argument "dim" is missing, with no default

which surprised me too.


For the first case, is the rationale related to:

> foo <- function(x, a=dim(x), dim) { a }
> foo(1)
Error in foo(1) : argument "dim" is missing, with no default

and

> foo <- function(x, a=dim(x), dim=a) { a }
> foo(1)
Error in foo(1) :
  promise already under evaluation: recursive default argument
reference or earlier problems?

[since here argument 'dim' could take a function, e.g. foo(1,
dim=length)], and that R treats

foo <- function(x, dim=dim(x)) { dim }

in a similar way?  That is, is R not "clever" enough to detect this as
a special case, but instead goes ahead and tries to evaluate the
default expression (=dim(x)) of argument 'dim' in order to get its
default value?  If so, is there anything preventing R from support
this "special case", e.g. by evaluating the default expression without
argument/symbol 'dim' itself being in the picture to avoid "it finds
itself"?  (Sorry if I'm using the incorrect words here).


Yes, I understand that I can do:

> foo <- function(x, dim=base::dim(x)) { dim }
> foo(1)
NULL

> foo <- function(x, dim=NULL) { if (is.null(dim)) dim <- dim(x); dim }
> foo(1)
NULL

or

> foo <- function(x, dim.=dim(x)) { dim. }
> foo(1)
NULL

but I would prefer not to have to turn those rather ad hoc solutions in my code.


Thanks,

Henrik

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


[Rd] Changing style for the Sweave vignettes

2014-11-14 Thread Gordon K Smyth

Date: Thu, 13 Nov 2014 12:09:47 +0100
From: January Weiner 
To: r-devel 
Subject: [Rd] Changing style for the Sweave vignettes

As a user, I am always annoyed beyond measure that Sweave vignettes
precede the code by a command line prompt. It makes running examples
by simple copying of the commands from the vignette to the console a
pain. I know the idea is that it is clear what is the command, and
what is the output, but I'd rather precede the output with some kind
of marking.

Is there any other solution possible / allowed in vignettes? I would
much prefer to make my vignettes easier to use for people like me.

Kind regards,
j.


There are different types of people, and some find the default Sweave 
format easier.


For a beginner, it is best that the code and output should look the same 
in the Sweave vignette as it would look on the screen during an actual 
session.


Windows users have access to "paste commands only".  For them the default 
Sweave vignette format is perfectly convenient -- one can easily cut and 
paste whole pages straight from pdf into the R session.


Perhaps a "paste commands only" app for Unix would keep everyone happy :)

Gordon

__
The information in this email is confidential and intend...{{dropped:4}}

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


Re: [Rd] Correction in help(factanal)

2014-11-14 Thread peter dalgaard
Done. Actually, I just dropped the row-vector bit. Doesn't seem necessary and 
the "column vectors stored as matrix rows" issue is (a) well-known and (b) 
generic to multivariate methods. 

> On 14 Nov 2014, at 10:09 , peter dalgaard  wrote:
> 
> Right. (Well, I suppose that you could transpose x and Lambda, but then it 
> would have to be  x = f Lambda + epsilon and all the dimensions would be 
> wrong.)
> 
> I'll fix this in R-devel.
> 
> -pd
> 
>> On 14 Nov 2014, at 00:13 , John Maindonald  
>> wrote:
>> 
>> <<<
>> Thus factor analysis is in essence a model for the correlation matrix of x,
>> 
>> Σ = Λ'Λ + Ψ
> 
>> 
>> This should surely be Σ = ΛΛ' + Ψ
>> 
>> Also line 3 under “Details” says
>> <<<
>> for a p–element row-vector x, …
> 
>> 
>> x is here surely a column vector, albeit the transpose of a row vector
>> from the data matrix.
>> 
>> cf page 322 of “Modern Applied Statistics with S”, 4th edn.
>> 
>> John Maindonald email: john.maindon...@anu.edu.au
>> phone : +61 2 (6125)3473fax  : +61 2(6125)5549
>> Centre for Mathematics & Its Applications, Room 1194,
>> John Dedman Mathematical Sciences Building (Building 27)
>> Australian National University, Canberra ACT 0200.
>> 
>> 
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> -- 
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd@cbs.dk  Priv: pda...@gmail.com
> 
> 
> 
> 
> 
> 
> 
> 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
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


Re: [Rd] Correction in help(factanal)

2014-11-14 Thread peter dalgaard
Right. (Well, I suppose that you could transpose x and Lambda, but then it 
would have to be  x = f Lambda + epsilon and all the dimensions would be wrong.)

I'll fix this in R-devel.

-pd

> On 14 Nov 2014, at 00:13 , John Maindonald  wrote:
> 
> <<<
> Thus factor analysis is in essence a model for the correlation matrix of x,
> 
> Σ = Λ'Λ + Ψ
 
> 
> This should surely be Σ = ΛΛ' + Ψ
> 
> Also line 3 under “Details” says
> <<<
> for a p–element row-vector x, …
 
> 
> x is here surely a column vector, albeit the transpose of a row vector
> from the data matrix.
> 
> cf page 322 of “Modern Applied Statistics with S”, 4th edn.
> 
> John Maindonald email: john.maindon...@anu.edu.au
> phone : +61 2 (6125)3473fax  : +61 2(6125)5549
> Centre for Mathematics & Its Applications, Room 1194,
> John Dedman Mathematical Sciences Building (Building 27)
> Australian National University, Canberra ACT 0200.
> 
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
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