[Rd] row.names in data.frame with row.names NULL
Vadim Organovich
vogranovich at jumptrading.com
Wed Aug 20 22:26:54 CEST 2008
Dear R-devel,
It appears that data.frame ignores row.names=NULL argument if it can guess the names from the first column. This behavior seems to contradict what the help page says, see the last sentence:
If row names are not supplied in the call to 'data.frame', the row
names are taken from the first component that has suitable names,
for example a named vector or a matrix with rownames or a data
frame. (If that component is subsequently recycled, the names are
discarded with a warning.) If 'row.names' was supplied as 'NULL'
or no suitable component was found the row names are the integer
sequence starting at one (and such row names are considered to be
'automatic', and not preserved by 'as.matrix').
Probably it should read "AND no suitable component was found ...", but I like the promise of the original description better.
Thanks,
Vadim
> row.names(data.frame(x=c(a=1,b=2), row.names=NULL))
[1] "a" "b"
> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 7.1
year 2008
month 06
day 23
svn rev 45970
language R
version.string R version 2.7.1 (2008-06-23)
>
Note: This email is for the confidential use of the named addressee(s) only and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you are hereby notified that any review, dissemination or copying of this email is strictly prohibited, and to please notify the sender immediately and destroy this email and any attachments. Email transmission cannot be guaranteed to be secure or error-free. Jump Trading, therefore, does not make any guarantees as to the completeness or accuracy of this email or any attachments. This email is for informational purposes only and does not constitute a recommendation, offer, request or solicitation of any kind to buy, sell, subscribe, redeem or perform any type of transaction of a financial product.
More information about the R-devel
mailing list