Re: [Rd] is.vector(as.vector(x, m), m) not always TRUE

2013-04-24 Thread peter dalgaard

On Apr 24, 2013, at 01:48 , Hervé Pagès wrote:

 In the man page for as.vector() (same as man page for vector()):
 
 Writers of methods for ‘as.vector’ need to take care to follow the
 conventions of the default method.  In particular
 
• Argument ‘mode’ can be ‘any’, any of the atomic modes,
  ‘list’, ‘expression’, ‘symbol’, ‘pairlist’ or one of
  the aliases ‘double’ and ‘name’.
 
• The return value should be of the appropriate mode.  For
  ‘mode = any’ this means an atomic vector or list.
 
• Attributes should be treated appropriately: in particular
  when the result is an atomic vector there should be no
  attributes, not even names.
 
• ‘is.vector(as.vector(x, m), m)’ should be true for any mode
  ‘m’, including the default ‘any’.
 
 But:
 
   is.vector(as.vector(a, name), name)
  [1] FALSE
 
 Mmmh, the default method itself doesn't seem to follow its own
 conventions :-/
 

Looks like there should be a straightforward fix, since

 is.vector(as.vector(a, name), symbol)
[1] TRUE

so it is just a matter of implementing name as synomyous with symbol.

-- 
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] is.vector(as.vector(x, m), m) not always TRUE

2013-04-24 Thread peter dalgaard
This is now fixed in R-devel (never actually bit anyone, did it?)

-pd

On Apr 24, 2013, at 08:11 , peter dalgaard wrote:

 
 is.vector(as.vector(a, name), name)
 [1] FALSE
 
 Mmmh, the default method itself doesn't seem to follow its own
 conventions :-/
 
 
 Looks like there should be a straightforward fix, since
 
 is.vector(as.vector(a, name), symbol)
 [1] TRUE
 
 so it is just a matter of implementing name as synomyous with symbol.

-- 
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] is.vector(as.vector(x, m), m) not always TRUE

2013-04-24 Thread Hervé Pagès

On 04/24/2013 09:02 AM, peter dalgaard wrote:

This is now fixed in R-devel (never actually bit anyone, did it?)


Thanks for fixing... before someone gets bitten :-)

as.vector() just made it into the BiocGenerics package, and the man
page for BiocGenerics::as.vector redirects the reader to the man page
for base::as.vector for the conventions that writers of methods for
as.vector should follow. Having base::as.vector actually follow
those conventions increases the chances that writers of as.vector
methods will follow them too, which is good.

Cheers,
H.




-pd

On Apr 24, 2013, at 08:11 , peter dalgaard wrote:



is.vector(as.vector(a, name), name)

[1] FALSE

Mmmh, the default method itself doesn't seem to follow its own
conventions :-/



Looks like there should be a straightforward fix, since


is.vector(as.vector(a, name), symbol)

[1] TRUE

so it is just a matter of implementing name as synomyous with symbol.




--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
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] is.vector(as.vector(x, m), m) not always TRUE

2013-04-23 Thread Hervé Pagès

In the man page for as.vector() (same as man page for vector()):

 Writers of methods for ‘as.vector’ need to take care to follow the
 conventions of the default method.  In particular

• Argument ‘mode’ can be ‘any’, any of the atomic modes,
  ‘list’, ‘expression’, ‘symbol’, ‘pairlist’ or one of
  the aliases ‘double’ and ‘name’.

• The return value should be of the appropriate mode.  For
  ‘mode = any’ this means an atomic vector or list.

• Attributes should be treated appropriately: in particular
  when the result is an atomic vector there should be no
  attributes, not even names.

• ‘is.vector(as.vector(x, m), m)’ should be true for any mode
  ‘m’, including the default ‘any’.

But:

   is.vector(as.vector(a, name), name)
  [1] FALSE

Mmmh, the default method itself doesn't seem to follow its own
conventions :-/

Cheers,
H.

 sessionInfo()
R version 3.0.0 (2013-04-03)
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=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C 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

loaded via a namespace (and not attached):
[1] tools_3.0.0

--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
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