From msuzen at gmail.com  Mon Apr 27 15:08:09 2015
From: msuzen at gmail.com (Suzen, Mehmet)
Date: Mon, 27 Apr 2015 14:08:09 +0100
Subject: [Rd] Inconsistency when naming a vector
In-Reply-To: <CABdHhvGLwS8RbZ9QXtHjr=NoSHyEqMKcUDh7598jNMFUKKit2A@mail.gmail.com>
References: <CABdHhvGLwS8RbZ9QXtHjr=NoSHyEqMKcUDh7598jNMFUKKit2A@mail.gmail.com>
Message-ID: <CAPtbhHzDnoP1VPxeGiSrojY3Sav4Y8qtq_5rqHyizef=+tmHPg@mail.gmail.com>

There is no inconsistency. Documentation of `names` says "...value
should be a character vector of up to the same length as x..."
In the first definition your character vector is not the same length
as length of x, so you enforce NA by not defining value[2]

x <- 1:2
value<-c("a")
value[2]
[1] NA

where as in the second case, R uses default value "", from `names`
documentation "..The name "" is special: it is used to indicate that
there is no name associated with an element.". Since you defined the
first one, it internally assigns "" to non-defined names to match the
length of the vector.



[Rd] Inconsistency when naming a vector
Suzen, Mehmet