Re: [Rd] Box.test reference correction (PR#13554)

2009-02-25 Thread Prof Brian Ripley

Thank you, incorporated now.

(My memory says we've been here before, so perhaps the correction did 
not get picked up last time around.)


On Tue, 24 Feb 2009, soly...@stat.math.ethz.ch wrote:


Full_Name: Peter Solymos
Version: 2.8.1
OS: Windows
Submission from: (NULL) (129.128.141.92)


The help page of the Box.test function (stats) states that the Ljung-Box test
was published in:

Ljung, G. M. and Box, G. E. P. (1978), On a measure of lack of fit in time
series models. Biometrika 65, 553--564.

The page numbers are incorrect. The correct citation should be as follows:

Ljung, G. M. and Box, G. E. P. (1978), On a measure of lack of fit in time
series models. Biometrika 65, 297--303.

Yours,

Peter

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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [Rd] [R] learning R

2009-02-25 Thread Wacek Kusnierczyk
a quick follow-up:

e = new.env()
e$a = 1
names(e)
# NULL
names(e) = 'a'
# error in names(e) = "foo" : names() applied to a non-vector

this is surprising.  names(e) 'works', there is no complaint, but when
names<- is used, the error is about the use of names, not names<-.

btw. ?names says:

"Description:

 Functions to get or set the names of an object.

Usage:

 names(x)
 names(x) <- value

Arguments:

   x: an R object.
"

and there is no clarification in the rest of the page that x cannot be
an environment, or that it has to be a vector.  furthermore:

p = pairlist(a=1)
names(p)
# "a"
names(p) = 'b'
# fine
is.vector(p)
# FALSE

which is incoherent with the above error message, in that p is *not* a
vector.

vQ



Wacek Kusnierczyk wrote:
>
> the following:
>
> names(a[2]) = 'foo'
>
> has (partially) a functional flavour, in that you assign to the names of
> a *copy* of a part of a, while
>
> names(a)[2] = 'foo'
>
> does not have the flavour, in that you assign to the names of a;  it
> seems, according to the man page you quote, to be equivalent to:
>
> a = 'names<-'(a, '[<-.'(names(a), 2, 'foo'))
>
> which proceeds as follows:
>
> tmp1 = names(a)
> # get a copy of the names of a, no effect on a
>
> tmp2 = '[<-'(tmp1, 2, 'foo')
> # get a copy of tmp1 with the second element replaced with 'foo'
> # no effect on either a or tmp1
>
> tmp3 = 'names<-'(a, tmp2)
> # get a copy of a with its names replaced with tmp2
> # no effect on either a, tmp1, or tmp2
>
> a = tmp3
> # backassign the result to a
>

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


Re: [Rd] [R] Semantics of sequences in R

2009-02-25 Thread Wacek Kusnierczyk
Berwin A Turlach wrote:



 on the other hand, i have seen quite a few responses that were
 bashing a user for reporting a non-existent bug or submitting an
 annoying patch.
 
 
>>> In didactic terms those are "negative motivations/reinforcements";
>>> opinion differ on how effective they are to reach certain learning
>>> outcomes.   
>>>   
>>>   
>> ah, so what's the difference between the way i pinpoint design flaws
>> and the way r gurus respond to people, so that i am running with a
>> chip on my shoulder, and they are being 'negatively
>> motivating/reinforcing' in didactic terms?  [...]
>> 
>
> Your goal is, presumably, that you want to have the design flaws
> fixed/discussed/&c.  The goal of the R gurus is to avoid having to
> waste their time on unproductive issues because people do not read
> documentation/behave contrary to how they are asked to behave/&c.
>
> To reach your goal, the controversial approach is counter productive.
> To reach their goal, the controversial approach can be quite effective.
>   

berwin, i have an additional reflection which i'd like to share with
thee.  glad to see thy opinion.

there certainly is a difference between the r gurus who develop and
maintain an impressive software system, and the average user who has
limited understanding of both the internals and the interface.  but this
difference is in the amount of knowledge about this specific product; 
in interpersonal communication, the developers and the users are
essentially *peers*. 

offline, i have been told that some of the r gurus can be equally
arrogant (read: negatively motivating/reinforcing) to other developers
as they are to users;  but why should a user care, especially that there
is no hierarchical dependence between the developers and the users,
while there may be between the developers?  (which would still not
justify arrogance, but some bosses just cannot let it be.)

when you seem to sanction and support the rudeness with which some r
gurus tend to respond to certain posts, and which is clearly documented
in a number of fortunes, you have no point in objecting to how certain
users write to you.  irrespectively of your achievements with r, you are
due to all users the same respect you expect to be treated with.  to
paraphrase from duncan's, you cannot demand anything from the users, and
if you expect them to be kind, be kind too.  or live with it.

vQ

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


Re: [Rd] [R] learning R

2009-02-25 Thread markleeds
 Hi Wacek: Somewhere I remember reading that environments have 
functionality like lists EXCEPT for the names part. IIRC, I think that I 
read this in the R Language Reference manual also.




On Wed, Feb 25, 2009 at  4:32 AM, Wacek Kusnierczyk wrote:


a quick follow-up:

e = new.env()
e$a = 1
names(e)
# NULL
names(e) = 'a'
# error in names(e) = "foo" : names() applied to a non-vector

this is surprising.  names(e) 'works', there is no complaint, but when
names<- is used, the error is about the use of names, not names<-.

btw. ?names says:

"Description:

 Functions to get or set the names of an object.

Usage:

 names(x)
 names(x) <- value

Arguments:

   x: an R object.
"

and there is no clarification in the rest of the page that x cannot be
an environment, or that it has to be a vector.  furthermore:

p = pairlist(a=1)
names(p)
# "a"
names(p) = 'b'
# fine
is.vector(p)
# FALSE

which is incoherent with the above error message, in that p is *not* a
vector.

vQ



Wacek Kusnierczyk wrote:


the following:

names(a[2]) = 'foo'

has (partially) a functional flavour, in that you assign to the names 
of

a *copy* of a part of a, while

names(a)[2] = 'foo'

does not have the flavour, in that you assign to the names of a;  it
seems, according to the man page you quote, to be equivalent to:

a = 'names<-'(a, '[<-.'(names(a), 2, 'foo'))

which proceeds as follows:

tmp1 = names(a)
# get a copy of the names of a, no effect on a

tmp2 = '[<-'(tmp1, 2, 'foo')
# get a copy of tmp1 with the second element replaced with 'foo'
# no effect on either a or tmp1

tmp3 = 'names<-'(a, tmp2)
# get a copy of a with its names replaced with tmp2
# no effect on either a, tmp1, or tmp2

a = tmp3
# backassign the result to a



__
r-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


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


Re: [Rd] invalid comparison in numeric sequence (PR#13551)

2009-02-25 Thread Peter Dalgaard
alexandre.court...@gmail.com wrote:
>
>> 0.6==0.6
> [1] TRUE
>> seq(0,1,0.1)==0.4
>  [1] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
>> seq(0,1,0.1)==0.6
>  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
>> seq(0,1,0.1)==0.8
>  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE
> 
> 
> What is wrong with 0.6 ??? (TRUE is missing)
> I tried 3 differents computers (2 Ubuntu with R 2.8.1, and one Mac with R 
> 2.8).

FAQ 7.31, not a bug. Expect about 10 people to tell you so.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

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


[Rd] S4 helper functions: regular or generic?

2009-02-25 Thread Gopi Goswami
Hi there,


I want to write helper functions for a base class, which will be used
by its subclasses in the S4 world. This function ___will___ update
certain slots of its argument object. Please help me decide which one
of the following is a better approach with respect to coding style,
memory usage and speed:

o   Write a regular function.
o   Declare a generic and implement it just for the base class.


Thanks for sharing your insight and time,
gopi.
http://gopi-goswami.net/

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


Re: [Rd] [R] length 1 offset in glm (& lm)

2009-02-25 Thread Heather Turner
This post about length 1 offsets on R help seems to have been ignored
(sorry deleted original email - is there a way to continue thread in
this case?)

https://stat.ethz.ch/pipermail/r-help/2009-February/189352.html

It does seem to be a bug, in that glm does not behave as documented. In
fact the same bug applies to lm as well.

I don't think the suggested fix works though - Y isn't available until
the model frame is evaluated. Moreover you would want to evaluate the
offset as part of the model frame, to take care of the search path,
subset and na.action.

One possibility would be to modify model.frame to recycle variables of
length one. This would be a potentially useful feature from my point of
view as offset(constant) could replace Const(constant) in gnm, which is
basically a work around for this problem in the case of specifying a
constant in a nonlinear term. However, this solution may have undesired
side-effects and I don't feel too strongly about it as there are various
 work-arounds. Perhaps the simplest solution would be to modify the docs
so that offsets of length one are disallowed - it is easy enough for the
user to create a vector of the right length as necessary.

Best regards,

Heather

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


Re: [Rd] [R] length 1 offset in glm (& lm)

2009-02-25 Thread Prof Brian Ripley

On Wed, 25 Feb 2009, Kenneth Knoblauch wrote:


Hi

Quoting Prof Brian Ripley :


On Wed, 25 Feb 2009, Heather Turner wrote:


This post about length 1 offsets on R help seems to have been ignored
(sorry deleted original email - is there a way to continue thread in
this case?)

https://stat.ethz.ch/pipermail/r-help/2009-February/189352.html


So let's be clear: this was the 'offset' argument' and not the offset()
function as you refer to below.


It occurs for both


Yes (I knew). but no one (AFAICS) said the function allows length-1 
arguments: Heather is raising the possibility that it should as new 
functionality, I believe.



c1 <- structure(list(Contr = c(0.028, 0.043, 0.064, 0.097, 0.146, 0.219
), Correct = c(34L, 57L, 94L, 152L, 160L, 160L), Incorrect = c(126L,
103L, 66L, 8L, 0L, 0L)), .Names = c("Contr", "Correct", "Incorrect"
), row.names = c(NA, 6L), class = "data.frame")

glm(cbind(Correct, Incorrect) ~ Contr + offset(qlogis(0.25)) - 1, binomial,
data = c1)
Error in model.frame.default(formula = cbind(Correct, Incorrect) ~ Contr +  :
variable lengths differ (found for 'offset(qlogis(0.25))')
+

Thanks for looking into this when time permits.

Ken

--- remaining deleted



--
Ken Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] [R] length 1 offset in glm (& lm)

2009-02-25 Thread Peter Dalgaard
Prof Brian Ripley wrote:
> On Wed, 25 Feb 2009, Kenneth Knoblauch wrote:
> 
>> Hi
>>
>> Quoting Prof Brian Ripley :
>>
>>> On Wed, 25 Feb 2009, Heather Turner wrote:
>>>
 This post about length 1 offsets on R help seems to have been ignored
 (sorry deleted original email - is there a way to continue thread in
 this case?)

 https://stat.ethz.ch/pipermail/r-help/2009-February/189352.html
>>>
>>> So let's be clear: this was the 'offset' argument' and not the offset()
>>> function as you refer to below.
>>
>> It occurs for both
> 
> Yes (I knew). but no one (AFAICS) said the function allows length-1
> arguments: Heather is raising the possibility that it should as new
> functionality, I believe.

Makes sense to have them consistent though, and we we do advertise that
recycling works for the argument. Looks like this could be fixed at the
level of model.frame.default, but the sticky bit is where to get the
repeat count in case the formula is something like "~-1". I don't quite
fathom the current rules:

> model.frame(~-1,offset=1)
  (offset)
11
> model.frame(~-1,offset=1,data=aq)
  (offset)
11
> model.frame(Ozone~-1,offset=1,data=aq)
Error in model.frame.default(Ozone ~ -1, offset = 1, data = aq) :
  variable lengths differ (found for '(offset)')
> model.frame(Ozone~-1,data=aq)
  Ozone
141
236
312
418
628
> model.frame(~-1,data=aq)
data frame with 0 columns and 6 rows

> foo <- 2:3
> model.frame(~foo-1,data=aq)
   foo
12
23
3 
4 
5 
6 
Warning message:
In format.data.frame(x, digits = digits, na.encode = FALSE) :
  corrupt data frame: columns will be truncated or padded with NAs
> foo <- 2
> model.frame(~foo-1,data=aq)
  foo
1   2




-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

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


Re: [Rd] [R] length 1 offset in glm (& lm)

2009-02-25 Thread Heather Turner

Prof Brian Ripley wrote:
> On Wed, 25 Feb 2009, Kenneth Knoblauch wrote:
> 
>> Hi
>>
>> Quoting Prof Brian Ripley :
>>
>>> On Wed, 25 Feb 2009, Heather Turner wrote:
>>>
 This post about length 1 offsets on R help seems to have been ignored
 (sorry deleted original email - is there a way to continue thread in
 this case?)

 https://stat.ethz.ch/pipermail/r-help/2009-February/189352.html
>>>
>>> So let's be clear: this was the 'offset' argument' and not the offset()
>>> function as you refer to below.
>>
>> It occurs for both
> 
> Yes (I knew). but no one (AFAICS) said the function allows length-1
> arguments: Heather is raising the possibility that it should as new
> functionality, I believe.
> 
Not particularly, just observing that if the problem of handling a
length one offset passed to the offset argument is solved by model.frame
doing the necessary recycling, then offset() would also work with length
one arguments (I think) and this could be a useful feature. If the
problem is solved by dealing with the offset argument separately, then
you wouldn't get this side-benefit, so it's just something to bear in
mind when deciding on a fix.

>> c1 <- structure(list(Contr = c(0.028, 0.043, 0.064, 0.097, 0.146, 0.219
>> ), Correct = c(34L, 57L, 94L, 152L, 160L, 160L), Incorrect = c(126L,
>> 103L, 66L, 8L, 0L, 0L)), .Names = c("Contr", "Correct", "Incorrect"
>> ), row.names = c(NA, 6L), class = "data.frame")
>>
>> glm(cbind(Correct, Incorrect) ~ Contr + offset(qlogis(0.25)) - 1,
>> binomial,
>> data = c1)
>> Error in model.frame.default(formula = cbind(Correct, Incorrect) ~
>> Contr +  :
>> variable lengths differ (found for 'offset(qlogis(0.25))')
>> +
>>
>> Thanks for looking into this when time permits.
>>
>> Ken
>>
>> --- remaining deleted
> 
>> -- 
>> Ken Knoblauch
>> Inserm U846
>> Stem-cell and Brain Research Institute
>> Department of Integrative Neurosciences
>> 18 avenue du Doyen Lépine
>> 69500 Bron
>> France
>> tel: +33 (0)4 72 91 34 77
>> fax: +33 (0)4 72 91 34 61
>> portable: +33 (0)6 84 10 64 10
>> http://www.sbri.fr/members/kenneth-knoblauch.html
>>
>

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


Re: [Rd] invalid comparison in numeric sequence (PR#13551)

2009-02-25 Thread John Nolan
This is one of the joys of floating point arithmetic.  Look at the 7th
element of

  seq(0,1,.1) - 0.6

Also, check the all.equal(x,y,tolerance=epsilon ) function.

John


-r-devel-boun...@r-project.org wrote: -


To: r-de...@stat.math.ethz.ch
From: alexandre.court...@gmail.com
Sent by: r-devel-boun...@r-project.org
Date: 02/24/2009 08:55AM
cc: r-b...@r-project.org
Subject: [Rd] invalid comparison in numeric sequence (PR#13551)

Full_Name: alex
Version: 2.8.1
OS: Ubuntu / MacOSX
Submission from: (NULL) (162.38.183.51)


> 0.6==0.6
[1] TRUE
> seq(0,1,0.1)==0.4
 [1] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
> seq(0,1,0.1)==0.6
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> seq(0,1,0.1)==0.8
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE


What is wrong with 0.6 ??? (TRUE is missing)
I tried 3 differents computers (2 Ubuntu with R 2.8.1, and one Mac with R
2.8).

__
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] [R] length 1 offset in glm (& lm)

2009-02-25 Thread Prof Brian Ripley

On Wed, 25 Feb 2009, Heather Turner wrote:


This post about length 1 offsets on R help seems to have been ignored
(sorry deleted original email - is there a way to continue thread in
this case?)

https://stat.ethz.ch/pipermail/r-help/2009-February/189352.html


So let's be clear: this was the 'offset' argument' and not the 
offset() function as you refer to below.



It does seem to be a bug, in that glm does not behave as documented. In
fact the same bug applies to lm as well.


Not ignored, just not yet resolved so nothing really useful to say as 
yet.  I suspect the documentation was once correct but the offset 
argument had some rather undesirable prperties at the time.  And there 
appears to be some legacy code to do the recycling.


So quite a bit of work is needed on the history to deal wth what is 
rather a small point: sorting out some problems with failing packages 
(rgdal and friends) has been a much higher priority (let alone the day 
jobs).



I don't think the suggested fix works though - Y isn't available until
the model frame is evaluated. Moreover you would want to evaluate the
offset as part of the model frame, to take care of the search path,
subset and na.action.


That used not to be the case for the offset _argument_, so probably 
where the docs came from.



One possibility would be to modify model.frame to recycle variables of
length one. This would be a potentially useful feature from my point of
view as offset(constant) could replace Const(constant) in gnm, which is
basically a work around for this problem in the case of specifying a
constant in a nonlinear term. However, this solution may have undesired
side-effects and I don't feel too strongly about it as there are various
work-arounds. Perhaps the simplest solution would be to modify the docs
so that offsets of length one are disallowed - it is easy enough for the
user to create a vector of the right length as necessary.

Best regards,

Heather

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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [Rd] S4 helper functions: regular or generic?

2009-02-25 Thread Martin Morgan
Hi Gopi --

Gopi Goswami  writes:

> Hi there,
>
>
> I want to write helper functions for a base class, which will be used
> by its subclasses in the S4 world. This function ___will___ update
> certain slots of its argument object. Please help me decide which one
> of the following is a better approach with respect to coding style,
> memory usage and speed:
>

My opinion:

> o   Write a regular function.

memory and speed

> o   Declare a generic and implement it just for the base class.

coding 'style', but style is subjective.

There are other aspects of S4, e.g., type checking, method dispatch,
programmatically defined and discoverable API, ... (positives),
cumbersome documentation (negative).

My usual pattern of development is to be seduced by the siren of
speed, only to regret boxing myself in.

I find that my S4 objects typically serve as containers for
coordinating other entities.  The important methods typically extract
R 'base' objects from the S4 class, manipulate them, and repackage the
result as S4. The time and speed issues are in the manipulation, not
in the extraction / repackaging. This is contrast to, say, an
implementation of a tree-like data structure with a collection of
'Node' objects, where tree operations would require access to each
object and would be horribly slow in S4 (and perhaps R when nodes were
represented as a list, say, at least compared to a C-level
representation, or an alternative representation that took advantage
of R's language characteristics).

Martin

>
> Thanks for sharing your insight and time,
> gopi.
> http://gopi-goswami.net/
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793

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


Re: [Rd] [R] length 1 offset in glm (& lm)

2009-02-25 Thread Prof Brian Ripley
Some digging showed that this has not worked for a long time and the 
documentation is either legacy or wishful thinking.  So for R-patched 
the right approach is to fix the documentation and I will do so 
shortly.


As for model.frame() recycling: that sounds an appealing idea and I 
don't think I would want to confine it to case of length one: exact 
repeats recycling are allowed in a number of places.  And re Peter's 
example, this could be done only when it is unambiguous, or only where 
there is a response or   But that will have to wait for another 
day (or another hand).


On Wed, 25 Feb 2009, Prof Brian Ripley wrote:


On Wed, 25 Feb 2009, Heather Turner wrote:


This post about length 1 offsets on R help seems to have been ignored
(sorry deleted original email - is there a way to continue thread in
this case?)

https://stat.ethz.ch/pipermail/r-help/2009-February/189352.html


So let's be clear: this was the 'offset' argument' and not the offset() 
function as you refer to below.



It does seem to be a bug, in that glm does not behave as documented. In
fact the same bug applies to lm as well.


Not ignored, just not yet resolved so nothing really useful to say as yet.  I 
suspect the documentation was once correct but the offset argument had some 
rather undesirable prperties at the time.  And there appears to be some 
legacy code to do the recycling.


So quite a bit of work is needed on the history to deal wth what is rather a 
small point: sorting out some problems with failing packages (rgdal and 
friends) has been a much higher priority (let alone the day jobs).



I don't think the suggested fix works though - Y isn't available until
the model frame is evaluated. Moreover you would want to evaluate the
offset as part of the model frame, to take care of the search path,
subset and na.action.


That used not to be the case for the offset _argument_, so probably where the 
docs came from.



One possibility would be to modify model.frame to recycle variables of
length one. This would be a potentially useful feature from my point of
view as offset(constant) could replace Const(constant) in gnm, which is
basically a work around for this problem in the case of specifying a
constant in a nonlinear term. However, this solution may have undesired
side-effects and I don't feel too strongly about it as there are various
work-arounds. Perhaps the simplest solution would be to modify the docs
so that offsets of length one are disallowed - it is easy enough for the
user to create a vector of the right length as necessary.

Best regards,

Heather

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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [Rd] invalid comparison in numeric sequence (PR#13551)

2009-02-25 Thread Petr Savicky
> > seq(0,1,0.1)==0.4
>  [1] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
> > seq(0,1,0.1)==0.6
>  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> > seq(0,1,0.1)==0.8
>  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE
> 
> What is wrong with 0.6 ??? (TRUE is missing)
> I tried 3 differents computers (2 Ubuntu with R 2.8.1, and one Mac with R 
> 2.8).

If you know that all the numbers in a sequence should have a given decimal
precision, then you obtain a better result using round(,digits=...).
For example,

  x <- round(seq(0,1,0.1), digits=1)
  rbind(x == 0.4, x == 0.6, x ==0.8)

produces

[,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10] [,11]
  [1,] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
  [2,] FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE
  [3,] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE

This does not mean, that x[7] is now equal to 0.6, however both x[7] and 0.6
are represented by the same 53-bit floating point number

  formatC(x[7], digits=20) # "0.5999778"
  formatC(0.6, digits=20)  # "0.5999778"

Petr.

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


[Rd] Unexpected side effect of the ":::" operator on the value of isGeneric

2009-02-25 Thread Wolfgang Huber
Hi,

when running the following on a fresh R,


  library("IRanges")
  annotation
  showMethods("annotation")
  Biobase:::annotation
  showMethods("annotation")


I get (see the "^" marked output at the bottom):


> library("IRanges")

Carico il pacchetto richiesto: 'IRanges'

The following object(s) are masked from package:base :

 cbind,
 order,
 pmax,
 pmax.int,
 pmin,
 pmin.int,
 rbind,
 rep.int,
 table

> annotation
standardGeneric for "annotation" defined from package "IRanges"

function (x, ...)
standardGeneric("annotation")

Methods may be defined for arguments: x
Use  showMethods("annotation")  for currently available ones.

> showMethods("annotation")
Function: annotation (package IRanges)
x="AnnotatedList"

> Biobase:::annotation
standardGeneric for "annotation" defined from package "Biobase"

function (object)
standardGeneric("annotation")

Methods may be defined for arguments: object
Use  showMethods("annotation")  for currently available ones.

> showMethods("annotation")

Function "annotation":
 
^^^


It seems that the value of isGeneric("annotation"), when it is called
within showMethods, is FALSE, while it is TRUE when called outside.



> sessionInfo()
R version 2.9.0 Under development (unstable) (2009-02-25 r48007)
x86_64-unknown-linux-gnu

locale:
LC_CTYPE=it_IT.UTF-8;LC_NUMERIC=C;LC_TIME=it_IT.UTF-8;LC_COLLATE=it_IT.UTF-8;LC_MONETARY=C;LC_MESSAGES=it_IT.UTF-8;LC_PAPER=it_IT.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=it_IT.UTF-8;LC_IDENTIFICATION=C

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

other attached packages:
[1] IRanges_1.1.40

loaded via a namespace (and not attached):
[1] Biobase_2.3.10



Best wishes
 Wolfgang

--
Wolfgang Huber  EBI/EMBL  Cambridge UK  http://www.ebi.ac.uk/huber

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


Re: [Rd] [R] make check reg-tests-1.R error on solaris

2009-02-25 Thread Prof Brian Ripley
Do you have a ZFS file system?  That seems to be the common factor 
where people have actually told us. However, other Solaris 
9/10/OpenSolaris systems work, as you will see from the R-admin 
manual.  We cannot help with errors we cannot reproduce: rather we 
need someone with the problem to help us.


Such questions are far more apporpriate to the R-devel list: see the 
posting guide.  So I have diverted this there.


On Wed, 25 Feb 2009, Karen Noel wrote:

R 2.5.1 compiled, passed the make check and has been successfully running for 
a couple years on a Sun Fire V490 running Solaris 9. I need a newer version 
of R, but can't get a newer version of R to pass the make check. I've tried 
2.8.1, 2.7.2, 2.6.2 and 2.6.0. (2.5.1 still passes on this server) At this 
point I thought I'd try to compile it on another Sun server (Solaris 10), but 
it had the same problem. Configuring with no options didn't help. I commented 
out the failed test from the Makefile to see if it would pass the rest of the 
tests. It passes all the rest of the tests. Here is the failure error from 
make check.


make[2]: Entering directory `/usr/local/src/R-2.8.1/tests'
running regression tests
make[3]: Entering directory `/usr/local/src/R-2.8.1/tests'
running code in 'reg-tests-1.R' ...make[3]: *** [reg-tests-1.Rout] Error 1
make[3]: Leaving directory `/usr/local/src/R-2.8.1/tests'
make[2]: *** [test-Reg] Error 2
make[2]: Leaving directory `/usr/local/src/R-2.8.1/tests'
make[1]: *** [test-all-basics] Error 1
make[1]: Leaving directory `/usr/local/src/R-2.8.1/tests'
make: *** [check] Error 2
bash-2.05#

Here is output from reg-tests-1.Rout.fail.

[1] "41c6167e" "dir1" "dir2" "dirs" 
"file275c23f2"

[6] "file33f963f2" "moredirs"

file.create(file.path(dd, "somefile"))

[1] TRUE TRUE TRUE TRUE

dir(".", recursive=TRUE)

[1] "41c6167e"  "dir1/somefile" "dir2/somefile"
[4] "dirs/somefile" "file275c23f2"  "file33f963f2"
[7] "moredirs/somefile"

stopifnot(unlink("dir?") == 1) # not an error

Error: unlink("dir?") == 1 is not TRUE
Execution halted
rm: Cannot remove any directory in the path of the current working directory
/tmp/RtmprBjF6W

Looking through the archives I did find a couple other people with this 
error, both running Solaris 10. PR#10501 and PR#11738 have quite a lot of 
information about this error, but I don't see any resolution for them.


This looks like it could possibly be enough of a problem that I haven't put 
2.8.1 in production. Can you help me with a resolution or let me know if it 
is safe to ignore? I'd appreciate it.


Thank you!
Karen

__
r-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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