Re: [R] cannot coerce class '"expression"' to a data.frame

2020-03-22 Thread Troels Ring
Thanks a lot - this does indeed do the trick! -Oprindelig meddelelse- Fra: peter dalgaard Sendt: 21. marts 2020 18:08 Til: Troels Ring Emne: Re: [R] cannot coerce class '"expression"' to a data.frame Oops, disregard previous... I'm no ggplot expert, but google "

Re: [R] cannot coerce class '"expression"' to a data.frame

2020-03-21 Thread William Dunlap via R-help
Try using the I() function in the call to data.frame. E.g., > d <- data.frame(X=1:3, Y=1:3, Substance=I(expression(H[2]*O, H[2] * O[2], H*S*O[4]))) > with(d, {plot(X,Y,type="n",xlim=c(0,4)); text(X, Y, Substance)}) Bill Dunlap TIBCO Software wdunlap tibco.com On Sat, Mar 21, 2020 at 1:45 AM

[R] cannot coerce class '"expression"' to a data.frame

2020-03-21 Thread Troels Ring
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)