[Rd] unlist preserve common class?
Spencer Graves
@pencer@gr@ve@ @end|ng |rom e||ect|vede|en@e@org
Fri Dec 9 01:12:34 CET 2022
Consider:
> str(unlist(list(Sys.Date())))
num 19334
> str(unlist(list(factor('a'))))
Factor w/ 1 level "a": 1
I naively expected "str(unlist(list(Sys.Date())))" to return an
object of class 'Date'. After some thought, I felt a need to ask this
list if they think that the core R language might benefit from modifying
the language so "str(unlist(list(Sys.Date())))" was of class 'Date', at
least as an option.
Comments?
Thanks,
Spencer Graves
> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.7.1
Matrix products: default
LAPACK:
/Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.2 tools_4.2.2
More information about the R-devel
mailing list