[Rd] Nice names in deparse
Suharto Anggono Suharto Anggono
suharto_anggono at yahoo.com
Fri Mar 30 02:19:53 CEST 2018
I am raising this again.
As
as.character(list(c(one = "1")))
is still
"1"
in R 3.5.0 alpha, could
as.character(list(c(one = 1)))
be
"1"
, too, as before?
The case here is the list component is atomic with length 1.
--------------------------------------------
On Sat, 16/12/17, Suharto Anggono Suharto Anggono <suharto_anggono at yahoo.com> wrote:
Subject: Nice names in deparse
To: r-devel at r-project.org
Date: Saturday, 16 December, 2017, 11:09 PM
Tags (argument names) in call to 'list' becomes names of the result. It is not necessarily so with call to 'c'. The default method of 'c' has 'recursive' and 'use.names' arguments.
In R devel r73778, with
x <- 0; names(x) <- "recursive" ,
dput(x)
or even
dput(x, control = "all")
gives
c(recursive = 0)
However, actual result of c(recursive = 0) is NULL.
Also with
x <- 0; names(x) <- "recursive" ,
dput(x, control = c("keepNA", "keepInteger", "showAttributes"))
in R devel r73778
gives
structure(c(0), .Names = "recursive")
The 'control' is suggested by an example for output as in R < 3.5.0. However, the output is slightly different from
dput(x)
in R 3.3.2:
structure(0, .Names = "recursive")
Part of NEWS item related with "niceNames" control option:
as.character(list( c (one = 1))) now includes the name, as as.character(list(list(one = 1))) has always done.
Please reconsider.
As
as.numeric(list(c(one = 1)))
gives
1 ,
I expect that
as.character(list(c(one = "1")))
gives
"1" .
It does in R devel r73778.
Why does
as.character(list(c(one = 1)))
give
"c(one = 1)" ?
as.numeric(list(c(one = "1")))
gives
1 .
list(list(one = 1))
is not quite the same.
as.numeric(list(list(one = 1)))
gives
NA .
More information about the R-devel
mailing list