[R] cannot coerce class '"expression"' to a data.frame
Troels Ring
tr|ng @end|ng |rom gvdnet@dk
Sat Mar 21 09:44:50 CET 2020
Dear friends - I have some old data of chemical results and want to annotate
the points with chemical formula. If I just do
ID <- c("HCl 7","HCl 5.25","HCl 3.5","HCL 7 no Na","HCl 3.5 No Na",
"HSO4 7 no Na",
"HNO3 7 No Na")
I can make a data.frame like
DD <- data.frame(x=1:7,ID)
and plotting works fine.
But if I try to format sulfuric acid and nitric acid like
ID <- c("HCl 7","HCl 5.25","HCl 3.5","HCL 7 no Na","HCl 3.5 No Na",
expression(paste(HSO[4]," 7 no Na")),
expression(paste(HNO[3]," 7 No Na")))
DD <- data.frame(x=1:7,ID)
Elicits an error
Error in as.data.frame.default(x[[i]], optional = TRUE) :
cannot coerce class '"expression"' to a data.frame
and plotting is prohibited - so how is this bypassed?
I'm on Windows 10,
R version 3.6.1 (2019-07-05)
All best wishes
Troels Ring, MD
Aalborg, Denmark
This email has been scanned by BullGuard antivirus protection.
For more info visit www.bullguard.com
<http://www.bullguard.com/tracking.aspx?affiliate=bullguard&buyaffiliate=smt
p&url=/>
[[alternative HTML version deleted]]
More information about the R-help
mailing list