Re: [Bioc-devel] SummarizedExperiment initialisation and manipulation question.

2015-06-30 Thread Nicolas Delhomme
Thanks for the quick action :-)

Nico

---
Nicolas Delhomme, PhD

The Street Lab
Department of Plant Physiology
Umeå Plant Science Center

Tel: +46 90 786 5478
Email: nicolas.delho...@umu.se
SLU - Umeå universitet
Umeå S-901 87 Sweden
---

 On 30 Jun 2015, at 07:56, Hervé Pagès hpa...@fredhutch.org wrote:
 
 Done in SummarizedExperiment 0.3.2.
 
 Thanks for the feedback,
 H.
 
 On 06/29/2015 10:26 PM, Hervé Pagès wrote:
 Hi Nico,
 
 It seems reasonable indeed to support rowRanges- on
 SummarizedExperiment0. It might be a little bit surprising for the
 user that the setter changes the class of the object but it looks
 like a perfectly legit situation for doing so here. Also there are
 some precedents:
 
 x - 1:5
 x[1] - a
 x
   [1] a 2 3 4 5
 
 and:
 
   library(Biostrings)
   dna - DNAString(GGATTAAA)
   class(dna)  # DNAString
   masks(dna) - Mask(length(dna), 2, 5)
   class(dna)  # MaskedDNAString
 
 I'll add this, unless someone has a better idea?
 
 Thanks,
 H.
 
 On 06/29/2015 03:13 AM, Nicolas Delhomme wrote:
 Hej alla!
 
 In the simpleRNASeq function of the easyRNASeq package, I start by
 instantiating a SummarizedExperiment object not initially providing
 the rowRanges. This results in the creation of an object of the class
 SummarizedExperiment0. When later, once I have validated the
 annotation, I try to extend the rowRanges of my SummarizedExperiment
 object, I get an error message that rowRanges- is not implemented
 for signature SummarizedExperiment0, GRangesList.
 
 I'm now wondering if this has been omitted on purpose for
 SummarizedExperiment0 objects or is not yet implemented. The reason
 I'm wondering is because there is the possibility to cast a
 SummarizedExperiment0 object as a RangedSummarizedExperiment (which is
 my current work-around), but I'm wondering if that's the best way to go.
 
 I don't have access to my Rsession right now, so no sessionInfo(), but
 I'm using R3.2.1 on OSX 10.10.3 (Yosemite), and the latest devel
 packages (updated today; SummarizedExperiment version is 0.3.0).
 
 Cheers,
 
 Nico
 ---
 Nicolas Delhomme, PhD
 
 The Street Lab
 Department of Plant Physiology
 Umeå Plant Science Center
 
 Tel: +46 90 786 5478
 Email: nicolas.delho...@umu.se
 SLU - Umeå universitet
 Umeå S-901 87 Sweden
 ---
 
 ___
 Bioc-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/bioc-devel
 
 
 
 -- 
 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...@fredhutch.org
 Phone:  (206) 667-5791
 Fax:(206) 667-1319

___
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel


[Rd] additional leap second

2015-06-30 Thread Ei-ji Nakama
hi,

Index: leap_second/src/library/base/R/zdatetime.R
===
--- leap_second/src/library/base/R/zdatetime.R(revision 68608)
+++ leap_second/src/library/base/R/zdatetime.R(working copy)
@@ -24,7 +24,8 @@
   1979-12-31, 1981-6-30, 1982-6-30, 1983-6-30,
   1985-6-30, 1987-12-31, 1989-12-31, 1990-12-31,
   1992-6-30, 1993-6-30, 1994-6-30,1995-12-31,
-  1997-6-30, 1998-12-31, 2005-12-31, 2008-12-31, 2012-6-30)
+  1997-6-30, 1998-12-31, 2005-12-31, 2008-12-31,
+  2012-6-30, 2015-6-30)
 .leap.seconds - strptime(paste(.leap.seconds , 23:59:60),
   %Y-%m-%d %H:%M:%S)
 c(as.POSIXct(.leap.seconds, GMT)) # lose the timezone

Best Regards,
--
Eiji NAKAMA nakama (a) ki.rim.or.jp
\u4e2d\u9593\u6804\u6cbb  nakama (a) ki.rim.or.jp

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


Re: [Rd] additional leap second

2015-06-30 Thread Duncan Murdoch
On 01/07/2015 7:20 AM, Ei-ji Nakama wrote:
 hi,
 
 Index: leap_second/src/library/base/R/zdatetime.R
 ===
 --- leap_second/src/library/base/R/zdatetime.R(revision 68608)
 +++ leap_second/src/library/base/R/zdatetime.R(working copy)
 @@ -24,7 +24,8 @@
1979-12-31, 1981-6-30, 1982-6-30, 1983-6-30,
1985-6-30, 1987-12-31, 1989-12-31, 1990-12-31,
1992-6-30, 1993-6-30, 1994-6-30,1995-12-31,
 -  1997-6-30, 1998-12-31, 2005-12-31, 2008-12-31, 2012-6-30)
 +  1997-6-30, 1998-12-31, 2005-12-31, 2008-12-31,
 +  2012-6-30, 2015-6-30)
  .leap.seconds - strptime(paste(.leap.seconds , 23:59:60),
%Y-%m-%d %H:%M:%S)
  c(as.POSIXct(.leap.seconds, GMT)) # lose the timezone
 
 Best Regards,
 --
 Eiji NAKAMA nakama (a) ki.rim.or.jp
 \u4e2d\u9593\u6804\u6cbb  nakama (a) ki.rim.or.jp

Thanks, I'll add it to R-devel and R-patched.

Duncan Murdoch

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


Re: [Rd] Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

2015-06-30 Thread Hadley Wickham
A slightly simpler formulation of the problem is:

show - function(...) stop(My show!)
methods::setClass(Person, slots = list(name = character))
methods::new(Person, name = Tom)
# Error in (function (...)  : My show!

Hadley

On Tue, Jun 30, 2015 at 9:02 AM, Dean Attali daatt...@gmail.com wrote:
 Hi r-devel

 If you define a function named `show` or attach a package with an exported
 `show` function, then printing/vieweing S4 objects breaks. This is probably
 because the `print` function calls `show`, which is now masked.

 Example:

 show - function() {}
 setClass(Person, slots = list(name = character))
 tom - new(Person, name = Tom)
 tom # error
 methods::show(tom) # works


 The error was a surprise to me because  I was under the assumption that
 `show` would be namespaced and therefore should not break.
 I'm wondering if this is intended behaviour, or if this is a problem.  My
 intuition, and Hadley agreed on Twitter, is that defining a `show` method
 should not have such a grave effect on printing S4 objects.

 Thanks

 ---
 http://deanattali.com

 [[alternative HTML version deleted]]

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



-- 
http://had.co.nz/

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


Re: [Rd] Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

2015-06-30 Thread Duncan Murdoch
On 30/06/2015 1:57 PM, Hadley Wickham wrote:
 A slightly simpler formulation of the problem is:
 
 show - function(...) stop(My show!)
 methods::setClass(Person, slots = list(name = character))
 methods::new(Person, name = Tom)
 # Error in (function (...)  : My show!

Just to be clear:  the complaint is that the auto-called show() is not
methods::show?  I.e. after

x - methods::new(Person, name = Tom)

you would expect

show(x)

to give the error, but not

x

??

Duncan Murdoch

 
 Hadley
 
 On Tue, Jun 30, 2015 at 9:02 AM, Dean Attali daatt...@gmail.com wrote:
 Hi r-devel

 If you define a function named `show` or attach a package with an exported
 `show` function, then printing/vieweing S4 objects breaks. This is probably
 because the `print` function calls `show`, which is now masked.

 Example:

 show - function() {}
 setClass(Person, slots = list(name = character))
 tom - new(Person, name = Tom)
 tom # error
 methods::show(tom) # works


 The error was a surprise to me because  I was under the assumption that
 `show` would be namespaced and therefore should not break.
 I'm wondering if this is intended behaviour, or if this is a problem.  My
 intuition, and Hadley agreed on Twitter, is that defining a `show` method
 should not have such a grave effect on printing S4 objects.

 Thanks

 ---
 http://deanattali.com

 [[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] Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

2015-06-30 Thread Hadley Wickham
On Tue, Jun 30, 2015 at 2:20 PM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
 On 30/06/2015 1:57 PM, Hadley Wickham wrote:
 A slightly simpler formulation of the problem is:

 show - function(...) stop(My show!)
 methods::setClass(Person, slots = list(name = character))
 methods::new(Person, name = Tom)
 # Error in (function (...)  : My show!

 Just to be clear:  the complaint is that the auto-called show() is not
 methods::show?  I.e. after

 x - methods::new(Person, name = Tom)

 you would expect

 show(x)

 to give the error, but not

 x

 ??

Correct - I'd expect print() to always call methods::show(), not
whatever show() is first on the search path.

Hadley

-- 
http://had.co.nz/

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


Re: [Rd] Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

2015-06-30 Thread Duncan Murdoch
On 30/06/2015 5:27 PM, Lorenz, David wrote:
 There is something I'm really missing here. The function show is a
 standardGeneric function, so the correct way to write it as method like
 this:

That describes methods::show.  The problem is that the default print
mechanism isn't calling methods::show() (or base::print() as Luke says),
it's calling show() or print() in the global environment, so the user's
function overrides the generic, and you get the error.

Luke, are you going to look at this, or should I?

Duncan Murdoch

 
 setMethod(show,  Person, function(object) {
 
 for an object of class Person for example.


 Dave
 
 On Tue, Jun 30, 2015 at 10:11 AM, luke-tier...@uiowa.edu wrote:
 
 Same thing happens with S3 if you redefine print(). I thought that
 code was actually calculating the function to call rather than the
 symbol to use, but apparently not. Shouldn't be too hard to fix.

 luke

 On Tue, 30 Jun 2015, Hadley Wickham wrote:

  On Tue, Jun 30, 2015 at 2:20 PM, Duncan Murdoch
 murdoch.dun...@gmail.com wrote:

 On 30/06/2015 1:57 PM, Hadley Wickham wrote:

 A slightly simpler formulation of the problem is:

 show - function(...) stop(My show!)
 methods::setClass(Person, slots = list(name = character))
 methods::new(Person, name = Tom)
 # Error in (function (...)  : My show!


 Just to be clear:  the complaint is that the auto-called show() is not
 methods::show?  I.e. after

 x - methods::new(Person, name = Tom)

 you would expect

 show(x)

 to give the error, but not

 x

 ??


 Correct - I'd expect print() to always call methods::show(), not
 whatever show() is first on the search path.

 Hadley



 --
 Luke Tierney
 Ralph E. Wareham Professor of Mathematical Sciences
 University of Iowa  Phone: 319-335-3386
 Department of Statistics andFax:   319-335-3017
Actuarial Science
 241 Schaeffer Hall  email:   luke-tier...@uiowa.edu
 Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu


 __
 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


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


Re: [Rd] Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

2015-06-30 Thread Lorenz, David
There is something I'm really missing here. The function show is a
standardGeneric function, so the correct way to write it as method like
this:

setMethod(show,  Person, function(object) {

for an object of class Person for example.
Dave

On Tue, Jun 30, 2015 at 10:11 AM, luke-tier...@uiowa.edu wrote:

 Same thing happens with S3 if you redefine print(). I thought that
 code was actually calculating the function to call rather than the
 symbol to use, but apparently not. Shouldn't be too hard to fix.

 luke

 On Tue, 30 Jun 2015, Hadley Wickham wrote:

  On Tue, Jun 30, 2015 at 2:20 PM, Duncan Murdoch
 murdoch.dun...@gmail.com wrote:

 On 30/06/2015 1:57 PM, Hadley Wickham wrote:

 A slightly simpler formulation of the problem is:

 show - function(...) stop(My show!)
 methods::setClass(Person, slots = list(name = character))
 methods::new(Person, name = Tom)
 # Error in (function (...)  : My show!


 Just to be clear:  the complaint is that the auto-called show() is not
 methods::show?  I.e. after

 x - methods::new(Person, name = Tom)

 you would expect

 show(x)

 to give the error, but not

 x

 ??


 Correct - I'd expect print() to always call methods::show(), not
 whatever show() is first on the search path.

 Hadley



 --
 Luke Tierney
 Ralph E. Wareham Professor of Mathematical Sciences
 University of Iowa  Phone: 319-335-3386
 Department of Statistics andFax:   319-335-3017
Actuarial Science
 241 Schaeffer Hall  email:   luke-tier...@uiowa.edu
 Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu


 __
 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


Re: [Rd] Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

2015-06-30 Thread luke-tierney

Same thing happens with S3 if you redefine print(). I thought that
code was actually calculating the function to call rather than the
symbol to use, but apparently not. Shouldn't be too hard to fix.

luke

On Tue, 30 Jun 2015, Hadley Wickham wrote:


On Tue, Jun 30, 2015 at 2:20 PM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:

On 30/06/2015 1:57 PM, Hadley Wickham wrote:

A slightly simpler formulation of the problem is:

show - function(...) stop(My show!)
methods::setClass(Person, slots = list(name = character))
methods::new(Person, name = Tom)
# Error in (function (...)  : My show!


Just to be clear:  the complaint is that the auto-called show() is not
methods::show?  I.e. after

x - methods::new(Person, name = Tom)

you would expect

show(x)

to give the error, but not

x

??


Correct - I'd expect print() to always call methods::show(), not
whatever show() is first on the search path.

Hadley




--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:   luke-tier...@uiowa.edu
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

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


[Rd] Why doesn't R have a float data type?

2015-06-30 Thread Charles Determan
This is strictly a curiosity question.  I am aware the R doesn't possess a
float data type.  I also don't mean to request that such functionality be
implemented as I'm sure it would require a large amount of work with
potential back compatibility conflicts.  But I wanted to know why R has
never had a float data type available?

Regards,
Charles

[[alternative HTML version deleted]]

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


Re: [Rd] Why doesn't R have a float data type?

2015-06-30 Thread Charles Determan
Hi Greg, I was referring to the single precision type.  Your points were
what I expected.  I just wanted to ask the R community if there was any
other reason than 'there wasn't any reason to implement it'.

Thanks,
Charles

On Tue, Jun 30, 2015 at 12:29 PM, Greg Snow 538...@gmail.com wrote:

 My understanding is that R does have a float type, it is just called
 double instead of float.

 If you are referring to a single precision floating point type, then R
 does have the as.single function, but that does not really change
 the way the number is stored, just sets a flag so that the proper
 conversion is done when passing to the .C or .fortran functions.
 The original S language and S+ would store things in single precision
 if needed, but for computations these values were almost always
 converted to doubles for precision.  By the time R was developed the
 memory saving of using single precision instead of double precision
 was not as big an issue, so I expect that nobody ever considered it
 worth the effort to fully implement the single precision storage.

 If you mean something else other than the above by float data type
 then please give us more details so that we can better answer the
 question.

 On Tue, Jun 30, 2015 at 10:42 AM, Charles Determan
 cdeterma...@gmail.com wrote:
  This is strictly a curiosity question.  I am aware the R doesn't possess
 a
  float data type.  I also don't mean to request that such functionality be
  implemented as I'm sure it would require a large amount of work with
  potential back compatibility conflicts.  But I wanted to know why R has
  never had a float data type available?
 
  Regards,
  Charles
 
  [[alternative HTML version deleted]]
 
  __
  R-devel@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-devel



 --
 Gregory (Greg) L. Snow Ph.D.
 538...@gmail.com


[[alternative HTML version deleted]]

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


Re: [Bioc-devel] rtracklayer bug?

2015-06-30 Thread Marc Carlson

Hi Arne,

So this time when I look at the bioc-devel email list, I don't see a 
record for this last name (or this email).  In fact the only way I could 
be sure it was you was that your post was the same...  ;) If you want to 
post from gmail, then you will need to subscribe the gmail address to 
the list here:


https://stat.ethz.ch/mailman/listinfo/bioc-devel



 Marc



On 06/30/2015 02:26 AM, Arne Müller wrote:

Hello,


I think there’s a problem in UCSCSession initializer in rtracklayer:

setMethod(initialize, UCSCSession,

   function(.Object, url =http://genome.ucsc.edu/cgi-bin/;,

user =ULL, session = NULL, force = FALSE, ...)

   {

 .Object@url - url

 .Object@views - new.env()

 gwURL - ucscURL(.Object, gateway)

 if (force) {

 gwURL - paste0(gwURL, '?redirect=anual')

 }

 gw - httpGet(gwURL, cookiefile =empfile(), header = TRUE,

   .parseúLSE)

 if (grepl(redirectTd, gw)) {

 url - sub(.*?a href=h([^[:space:]]+cgi-bin/).*,
h\\1, gw)

 return(initialize(.Object, url, user=er, session=session,

   force=UE, ...))

 }

 cookie - grep(Set-[Cc]ookie: hguid[^==, gw)

 if (!length(cookie))

   stop(Failed to obtain 'hguid' cookie)

 hguid - sub(.*Set-Cookie: (hguid[^==[^;]*);.*, \\1, gw)

 .Object@hguid - hguid

 if (!is.null(user)  !is.null(session)) { ## bring in other
session

   ucscGet(.Object, tracks,

   list(hgS_doOtherUser =submit, hgS_otherUserName user,

hgS_otherUserSessionName =ession))

 }

 .Object

   })



Shouldn’t ‘…’ be passed to httpGet that in turn is passed to RCURL, I.e.


gw - httpGet(gwURL, cookiefile =empfile(), header = TRUE,

   .parseúLSE, …) ?

We run an internal instance of the UCSC genome browser and need to pass a
cookie to all http-requests. The problem is that

session =ew ('UCSCSession', url=myInternalURL, cookie=myAuthCookie)


Does not pass the ‘cookie’ argument to httpGet.


Regards,


Arne

[[alternative HTML version deleted]]



___
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel


Re: [Rd] Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

2015-06-30 Thread Paul Gilbert



On 06/30/2015 11:33 AM, Duncan Murdoch wrote:

On 30/06/2015 5:27 PM, Lorenz, David wrote:

There is something I'm really missing here. The function show is a
standardGeneric function, so the correct way to write it as method like
this:


That describes methods::show.  The problem is that the default print
mechanism isn't calling methods::show() (or base::print() as Luke says),
it's calling show() or print() in the global environment, so the user's
function overrides the generic, and you get the error.


These are two different problems aren't they? I can see that you might 
want to ensure that base::print() calls methods::show(), but forcing the 
default print to go to base::print(), rather than whatever print() is 
first on the search path, would seem like a real change of philosophy. 
What about all the other base functions that can be overridden by 
something in the global environment?


Paul


Luke, are you going to look at this, or should I?

Duncan Murdoch



setMethod(show,  Person, function(object) {

for an object of class Person for example.




Dave

On Tue, Jun 30, 2015 at 10:11 AM, luke-tier...@uiowa.edu wrote:


Same thing happens with S3 if you redefine print(). I thought that
code was actually calculating the function to call rather than the
symbol to use, but apparently not. Shouldn't be too hard to fix.

luke

On Tue, 30 Jun 2015, Hadley Wickham wrote:

  On Tue, Jun 30, 2015 at 2:20 PM, Duncan Murdoch

murdoch.dun...@gmail.com wrote:


On 30/06/2015 1:57 PM, Hadley Wickham wrote:


A slightly simpler formulation of the problem is:

show - function(...) stop(My show!)
methods::setClass(Person, slots = list(name = character))
methods::new(Person, name = Tom)
# Error in (function (...)  : My show!



Just to be clear:  the complaint is that the auto-called show() is not
methods::show?  I.e. after

x - methods::new(Person, name = Tom)

you would expect

show(x)

to give the error, but not

x

??



Correct - I'd expect print() to always call methods::show(), not
whatever show() is first on the search path.

Hadley




--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
Actuarial Science
241 Schaeffer Hall  email:   luke-tier...@uiowa.edu
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu


__
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



__
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] Why doesn't R have a float data type?

2015-06-30 Thread Greg Snow
My understanding is that R does have a float type, it is just called
double instead of float.

If you are referring to a single precision floating point type, then R
does have the as.single function, but that does not really change
the way the number is stored, just sets a flag so that the proper
conversion is done when passing to the .C or .fortran functions.
The original S language and S+ would store things in single precision
if needed, but for computations these values were almost always
converted to doubles for precision.  By the time R was developed the
memory saving of using single precision instead of double precision
was not as big an issue, so I expect that nobody ever considered it
worth the effort to fully implement the single precision storage.

If you mean something else other than the above by float data type
then please give us more details so that we can better answer the
question.

On Tue, Jun 30, 2015 at 10:42 AM, Charles Determan
cdeterma...@gmail.com wrote:
 This is strictly a curiosity question.  I am aware the R doesn't possess a
 float data type.  I also don't mean to request that such functionality be
 implemented as I'm sure it would require a large amount of work with
 potential back compatibility conflicts.  But I wanted to know why R has
 never had a float data type available?

 Regards,
 Charles

 [[alternative HTML version deleted]]

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



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

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


Re: [Rd] Why doesn't R have a float data type?

2015-06-30 Thread Prof Brian Ripley

On 30/06/2015 17:42, Charles Determan wrote:

This is strictly a curiosity question.  I am aware the R doesn't possess a
float data type.  I also don't mean to request that such functionality be
implemented as I'm sure it would require a large amount of work with
potential back compatibility conflicts.  But I wanted to know why R has
never had a float data type available?


You said it:

'it would require a large amount of work'

and not just for R but also for many packages that users would expect to 
support data in that format.


By the time R started to spread (late 90s), most FPUs were primarily 
double/extended precision and there was little or no speed advantage to 
single-precision calculations.  And although S[-PLUS] had a 'single' 
type, we knew it was little used by then.


For a few people the storage size may matter (and for others the 32-bit 
logicals are wasteful): although for most people RAM is cheap enough, 
there are packages such as 'ff' which address this.




Regards,
Charles



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

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


Re: [Rd] Why doesn't R have a float data type?

2015-06-30 Thread Hervé Pagès

Hi Charles,

Probably for the same reason it doesn't have short int, short unsigned
int, long int, long unsigned int, long long int, long long unsigned int,
long double etc... There are many built-in types in C and, in order
to keep things simple, I guess the line had to be drew somewhere.
Said otherwise, I don't think the atomic types in R were ever meant to
reflect exactly what's available in C.

Note that some CRAN packages (e.g. bit64) try to remedy this by
providing support for atomic-like types that are not natively supported
by R. I don't know if there is one for float though.

Cheers,
H.

On 06/30/2015 09:42 AM, Charles Determan wrote:

This is strictly a curiosity question.  I am aware the R doesn't possess a
float data type.  I also don't mean to request that such functionality be
implemented as I'm sure it would require a large amount of work with
potential back compatibility conflicts.  But I wanted to know why R has
never had a float data type available?

Regards,
Charles

[[alternative HTML version deleted]]

__
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, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

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

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


Re: [Rd] Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

2015-06-30 Thread Duncan Murdoch
On 30/06/2015 7:04 PM, Paul Gilbert wrote:
 
 
 On 06/30/2015 11:33 AM, Duncan Murdoch wrote:
 On 30/06/2015 5:27 PM, Lorenz, David wrote:
 There is something I'm really missing here. The function show is a
 standardGeneric function, so the correct way to write it as method like
 this:

 That describes methods::show.  The problem is that the default print
 mechanism isn't calling methods::show() (or base::print() as Luke says),
 it's calling show() or print() in the global environment, so the user's
 function overrides the generic, and you get the error.
 
 These are two different problems aren't they? I can see that you might 
 want to ensure that base::print() calls methods::show(), but forcing the 
 default print to go to base::print(), rather than whatever print() is 
 first on the search path, would seem like a real change of philosophy. 
 What about all the other base functions that can be overridden by 
 something in the global environment?

I'd guess it's a minority of R users who know that print() or show() is
being called when you just evaluate an expression.  Most would think R
just shows you the value of the expression.  That's why they'd be
surprised when their local function suddenly stops the display of
variables from working.

On the other hand, if someone defined a print or show *method* in the
global environment, I think that one should override one defined in a
package namespace.  It does now, and I wouldn't change that.  The
difference is that I'd expect someone defining a method to know what
they're doing, but just defining a function doesn't imply that.

Duncan Murdoch

 
 Paul

 Luke, are you going to look at this, or should I?

 Duncan Murdoch


 setMethod(show,  Person, function(object) {

 for an object of class Person for example.


 Dave

 On Tue, Jun 30, 2015 at 10:11 AM, luke-tier...@uiowa.edu wrote:

 Same thing happens with S3 if you redefine print(). I thought that
 code was actually calculating the function to call rather than the
 symbol to use, but apparently not. Shouldn't be too hard to fix.

 luke

 On Tue, 30 Jun 2015, Hadley Wickham wrote:

   On Tue, Jun 30, 2015 at 2:20 PM, Duncan Murdoch
 murdoch.dun...@gmail.com wrote:

 On 30/06/2015 1:57 PM, Hadley Wickham wrote:

 A slightly simpler formulation of the problem is:

 show - function(...) stop(My show!)
 methods::setClass(Person, slots = list(name = character))
 methods::new(Person, name = Tom)
 # Error in (function (...)  : My show!


 Just to be clear:  the complaint is that the auto-called show() is not
 methods::show?  I.e. after

 x - methods::new(Person, name = Tom)

 you would expect

 show(x)

 to give the error, but not

 x

 ??


 Correct - I'd expect print() to always call methods::show(), not
 whatever show() is first on the search path.

 Hadley



 --
 Luke Tierney
 Ralph E. Wareham Professor of Mathematical Sciences
 University of Iowa  Phone: 319-335-3386
 Department of Statistics andFax:   319-335-3017
 Actuarial Science
 241 Schaeffer Hall  email:   luke-tier...@uiowa.edu
 Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu


 __
 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


 __
 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: [Bioc-devel] rtracklayer bug?

2015-06-30 Thread Michael Lawrence
I will add ... to the httpGet call.

On Tue, Jun 30, 2015 at 10:10 AM, Marc Carlson mcarl...@fredhutch.org wrote:
 Hi Arne,

 So this time when I look at the bioc-devel email list, I don't see a record
 for this last name (or this email).  In fact the only way I could be sure it
 was you was that your post was the same...  ;) If you want to post from
 gmail, then you will need to subscribe the gmail address to the list here:

 https://stat.ethz.ch/mailman/listinfo/bioc-devel



  Marc



 On 06/30/2015 02:26 AM, Arne Müller wrote:

 Hello,


 I think there’s a problem in UCSCSession initializer in rtracklayer:

 setMethod(initialize, UCSCSession,

function(.Object, url =http://genome.ucsc.edu/cgi-bin/;,

 user =ULL, session = NULL, force = FALSE, ...)

{

  .Object@url - url

  .Object@views - new.env()

  gwURL - ucscURL(.Object, gateway)

  if (force) {

  gwURL - paste0(gwURL, '?redirect=anual')

  }

  gw - httpGet(gwURL, cookiefile =empfile(), header = TRUE,

.parseúLSE)

  if (grepl(redirectTd, gw)) {

  url - sub(.*?a href=h([^[:space:]]+cgi-bin/).*,
 h\\1, gw)

  return(initialize(.Object, url, user=er, session=session,

force=UE, ...))

  }

  cookie - grep(Set-[Cc]ookie: hguid[^==, gw)

  if (!length(cookie))

stop(Failed to obtain 'hguid' cookie)

  hguid - sub(.*Set-Cookie: (hguid[^==[^;]*);.*, \\1, gw)

  .Object@hguid - hguid

  if (!is.null(user)  !is.null(session)) { ## bring in other
 session

ucscGet(.Object, tracks,

list(hgS_doOtherUser =submit, hgS_otherUserName
 user,

 hgS_otherUserSessionName =ession))

  }

  .Object

})



 Shouldn’t ‘…’ be passed to httpGet that in turn is passed to
 RCURL, I.e.


 gw - httpGet(gwURL, cookiefile =empfile(), header = TRUE,

.parseúLSE, …) ?

 We run an internal instance of the UCSC genome browser and need to pass a
 cookie to all http-requests. The problem is that

 session =ew ('UCSCSession', url=myInternalURL, cookie=myAuthCookie)


 Does not pass the ‘cookie’ argument to httpGet.


 Regards,


 Arne

 [[alternative HTML version deleted]]


 ___
 Bioc-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/bioc-devel

___
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel


[Rd] Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

2015-06-30 Thread Dean Attali
Hi r-devel

If you define a function named `show` or attach a package with an exported
`show` function, then printing/vieweing S4 objects breaks. This is probably
because the `print` function calls `show`, which is now masked.

Example:

show - function() {}
 setClass(Person, slots = list(name = character))
 tom - new(Person, name = Tom)
 tom # error
 methods::show(tom) # works


The error was a surprise to me because  I was under the assumption that
`show` would be namespaced and therefore should not break.
I'm wondering if this is intended behaviour, or if this is a problem.  My
intuition, and Hadley agreed on Twitter, is that defining a `show` method
should not have such a grave effect on printing S4 objects.

Thanks

---
http://deanattali.com

[[alternative HTML version deleted]]

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


Re: [Rd] Guidelines for S3 regression models

2015-06-30 Thread Stephen Milborrow

Given how much documentation is available on R coding in general, it is
surprising how little is available specifically on writing model code.
Researchers who come up with a new method of regression, and who want to
write an S3 model for that method, must currently go all the way back to the 
Venables and Ripley S programming book.



On 26.06.2015 14:09, Stephen Milborrow wrote:
 Once we have built a regression model, we typically want to use the
 model for further processing, such as making predictions from the model
 or plotting the residuals.  Unfortunately, for many packages on CRAN
 this can be difficult.

 For example, some models don't have a residuals method and don't save
 the call or data --- so you can't tell how to generate the residuals
 from the model object itself.

 A common snag is that for some models the new data for predict() has to
 be a matrix; for others it has to be a data.frame.  This places an
 unnecessary burden on the user when both data.frames and matrices can
 easily be supported by predict.

 To mitigate such issues, I'm going out on a limb and presenting some
 guidelines for writers of S3 regression model functions (this document
 is currently part of the plotmo package):
 http://www.milbo.org/doc/modguide.pdf

On 26.06.2015 16:41, Achim Zeileis wrote:
I think this is a nice and useful starting point. It's probably not
comprehensive (yet) but will surely help.

You could add something more about writing the formula interface and the
correct processing of model.frame, terms, model.response, model.matrix,
model.weights, model.offset. Especially for models with linear predictors
the latter two can be very useful and are often not hard to implement. In
case the model has multiple parts or multiple responses, the Formula
package (and its vignette) might also be helpful.

As for the S3 methods, I would omit coefficients, fitted.values, and resid
from the list. These dispatch to coef, fitted, and residuals anyway. For
inference it would also be very useful to add nobs(), df.residual(),
vcov(), and logLik() and/or deviance() where applicable. An overview which
lists some (but not all) useful methods is in Table 1 of
vignette(betareg, package = betareg).

For coef() and vcov() it is useful/important that the names and dimension
match. Then Wald tests can be easily computed in functions like
car::linearHypothesis(), car::deltaMethod(), lmtest::waldtest(), or
lmtest::coeftest().


Thanks for these, I'll update the document.

Stephen Milborrow

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