[Rd] wishlist: attribute "na.omit" added to data.frame from model.frame.default (PR#9134)

2006-08-09 Thread hayfietj
Full_Name: Tristen Hayfield
Version: 2.3.1
OS: Windows
Submission from: (NULL) (130.113.139.87)


It would be nice if model.frame.default() (and any other model.frame()
functions) set the "na.omit" attribute on the returned d.f, so that the caller
could determine what action was taken.

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


Re: [Rd] unique.default() drops names (PR#9130)

2006-08-09 Thread Gregor Gorjanc
Prof Brian Ripley wrote:
> From the help page (?unique)
> 
>  Value:
> 
>  For a vector, an object of the same type of 'x', but with only one
>  copy of each duplicated element.  No attributes are copied (so the
>  result has no names).
> 
> Please take your own advice and `learn by doing as you are asked in the 
> posting guide'.

Thank you for the reply! I appologize for not reading the latest
documentation - there was no word about droping names in 2.3.1. However,
I do wonder why simple fix (as shown in previous mail) is not OK.
Afterall, there is considerable variability on what unique methods drop
and what they preserve. Say:

* factor - keep all levels as in x
* data.frame - keep rownames (which are "needed" by default anyway)
* matrix - keep rownames as well as colnames

and I am perfectly fine with all these, I just wonder why names should
be dropped if x is atomic and not (rownames and colnames) if x is a
matrix, array or data.frame. Did I miss something or does addition of
names back to atomic x break existing code?

R> x <- c(1, 2, 3, 2)
R> names(x) <- 1:length(x)
R> unique(x)
[1] 1 2 3
R> y <- matrix(x)
R> colnames(y) <- 1; rownames(y) <- names(x)
R> t(unique(y))
colnames(y) <- 1; rownames(y) <- names(x)

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc  bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.

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


[Rd] Wishlist: multiple classes in \method{}{} (Rd markup) (PR#9135)

2006-08-09 Thread gregor . gorjanc
Hello!

I wish that one could use

\method{myMethod}{classA, classB}(x, arg1, arg2, arg3, ...)

instead of

\method{myMethod}{classA}(x, arg1, arg2, arg3, ...)
\method{myMethod}{classB}(x, arg1, arg2, arg3, ...)

when methods for both classA and classB have same set of arguments. This
way there would be a line or two less markup in Rd file as well as in
produced help page - one with note for both (or several classes) is more
than enough. This might also ease reading of help pages.

Thank you very much for such a great software!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc  bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.

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


Re: [Rd] wishlist: attribute "na.omit" added to data.frame from model.frame.default (PR#9134)

2006-08-09 Thread Gabor Grothendieck
On 8/9/06, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
> You can get this from the returned object.  Is that sufficient?
>
> > iris2 <- iris
> > iris2[1,1] <- NA
> > mf <- model.frame(Sepal.Length ~ Species, iris2, na.action = na.omit)
> > attr(mf, "na.action")
> 1
> 1
> attr(,"class")
> [1] "omit"
>
> On 8/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Full_Name: Tristen Hayfield
> > Version: 2.3.1
> > OS: Windows
> > Submission from: (NULL) (130.113.139.87)
> >
> >
> > It would be nice if model.frame.default() (and any other model.frame()
> > functions) set the "na.omit" attribute on the returned d.f, so that the 
> > caller
> > could determine what action was taken.
> >
> > __
> > 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] (PR#9134) wishlist: attribute "na.omit" added to data.frame

2006-08-09 Thread ripley
What is the "na.omit" attribute, and why is that relevant to 
model.frame.default (where na.action is an argument and only defaults to 
na.omit)?

Consider

> DF <- data.frame(x = c(1, 2, 3), y = c(0, 10, NA))
> attr(model.frame(y ~ x, DF), "na.action")
3
3
attr(,"class")
[1] "omit"

so the *na.action* attribute is set to allow users to determine what 
action is taken.  This is exactly as documented in ?na.omit.  (Further, 
lots of code (including naresid and napredict) makes use of this.)

Please explain in detail what you meant and why the documented actions do 
not suffice.


On Wed, 9 Aug 2006, [EMAIL PROTECTED] wrote:

> Full_Name: Tristen Hayfield
> Version: 2.3.1
> OS: Windows
> Submission from: (NULL) (130.113.139.87)
> 
> 
> It would be nice if model.frame.default() (and any other model.frame()
> functions) set the "na.omit" attribute on the returned d.f, so that the caller
> could determine what action was taken.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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