From ggrothendieck at gmail.com  Sat Sep 19 00:44:44 2009
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Fri, 18 Sep 2009 18:44:44 -0400
Subject: [Rd] what should names(x) be padded with when length(x) is
	increased?
In-Reply-To: <77EB52C6DD32BA4D87471DCD70C8D70001CE5F9D@NA-PA-VBE03.na.tibco.com>
References: <77EB52C6DD32BA4D87471DCD70C8D70001CE5F9D@NA-PA-VBE03.na.tibco.com>
Message-ID: <971536df0909181544x8ef2797x80ccf5a852bda0ce@mail.gmail.com>

The graphviz site, itself, lists resources/alternatives here:
http://www.graphviz.org/Resources.php

On Fri, Sep 18, 2009 at 6:34 PM, William Dunlap <wdunlap at tibco.com> wrote:
> R version 2.10.0 Under development (unstable) (2009-09-08 r49628)
>
> Here are two somewhat related questions.
>
> First, when we attach a too short names vector to a vector
> the names vector is padded with NA's to the length of the
> main vector: ?E.g.,
> ? > x<-1:3
> ? > names(x)<-c("One","Two")
> ? > str(x)
> ? ?Named int [1:3] 1 2 3
> ? ?- attr(*, "names")= chr [1:3] "One" "Two" NA
> I expected this length mismatch to cause an error, but I am
> biassed by my long usage of S and S+. ?Is the extension by
> padding with NA what is wanted?
>
> Second, if we extend a named vector with length<- the main
> vector is padded with NA's but the names are padded with
> empty strings. ?Should those be NA's?
>
> ? > x<-1:3
> ? > names(x)<-c("One","Two")
> ? > length(x)<-4
> ? > str(x)
> ? ?Named int [1:4] 1 2 3 NA
> ? ?- attr(*, "names")= chr [1:4] "One" "Two" NA ""
>
> The names "" and NA act alike in that subscript by either
> returns structure(NA, names=NA_character_), but they
> print differently
> ? > x
> ? ?One ?Two <NA>
> ? ? 1 ? ?2 ? ?3 ? NA
>
>
> Bill Dunlap
> TIBCO Software Inc - Spotfire Division
> wdunlap tibco.com
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] what should names(x) be padded with when length(x) is increased?
Gabor Grothendieck