[Rd] "with" doesn't work with names with blanks
Spencer Graves
@pencer@gr@ve@ @end|ng |rom prod@y@e@com
Sun May 1 21:41:39 CEST 2022
Hello, All:
Column names in a data.frame are not supposed to have trailing
blanks. However, a CRAN package created one, which threw an error with
"with". Consider the following example:
> (tst <- data.frame(1))
X1
1 1
> names(tst) <- 'x '
> tst$x
[1] 1
> with(txt, x)
Error in with(txt, x) : object 'txt' not found
I think it's interesting that "tst$x" works, but "with(txt, x)".
Comments?
It's not a major problem, though it took me a while to diagnose. (I
reported it to the maintainer of the package that returned a data.frame
with names with trailing blanks.)
Thanks, for all your work in maintaining and upgrading R -- and in
responding to emails from this list.
Spencer Graves
> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.6.5
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.0 tools_4.2.0
>
More information about the R-devel
mailing list