> Duncan Murdoch wrote:
>> On 31/01/2009 7:31 AM, Andrew Piskorski wrote:
>>> On Fri, Jan 30, 2009 at 11:51:00AM -0500, Simon Urbanek wrote:
>>>> Subject: Re: [Rd] (PR#13487) Segfault when mistakenly calling
>>> ever tried drop=FALSE ?
>>> Simon, no, the drop=FALSE argument has nothing to do with what
>>> Christian was talking about. The kind of thing he meant is PR# 8192,
>>> "Subject: [ subscripting sometimes loses names":
>> In that bug report you were asked to provide simple examples, and you
>> I just tracked this one down, and can put together this simple example:
>> > (1:3)["no"]
>>  NA
>> where I think you would want the name "no" attached to the output.
> No, it has nothing to do with indexing by name. It's about preserving
existing names when subsetting.
And the other two cases where you list "BAD" behaviour? I didn't track them
> I did, and they boil down to variations of
> > data.frame(val=1:3,row.names=letters[1:3])[,1]
>  1 2 3
> but it's not obvious that the result should be named using the row.names
> and (in particular) whether or why it should differ from .....[] and
> ....$val. Given that for most purposes, extracting the relevant names would
> just be unnecessary red tape, I'd say that we can do without it.
X[,1] preserves row names if X is a matrix, and loses them if X is a data frame. To me, this is ugly and inconsistent.
One might argue that having names and dimnames at all is "red tape", and wastes memory and computational efficiency -- after all, Fortran arrays had no names. But R chose to drag along the names (sometimes), and it can be very helpful to us humans. Now R should do it consistently.
[[alternative HTML version deleted]]
Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Archive generated by hypermail 2.2.0, at Sun 01 Feb 2009 - 04:30:17 GMT.
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.
list of date sections of archive