From: Peter M. <pet...@ad...> - 2014-08-21 00:42:41
|
Hi, I'm seeking to create a modified copy of the generic rkward plot plug-in to add a regression line, plus r-square and other regression parameters. Here's an example of the R code I'd like to get to, but for which I don't understand the precise rk-to-R syntax I require: plot(y-var~x-var, data = my.data, las = 1)#can use existing .js code; las rotates labels lml <- lm(my.data$yvar~my.data$x-var) abline(lml, col = "blue") text(my.data$x-var,my.data$y-var,my.data$point-id-var, pos = 2, offset = -.5, cex = .65)#identifies data points with abbreviations lmlsum <- summary (lml) title( sub = paste ("R2 = ", signif(lmlsum$r.squared, 3),"; Intercept = ", signif(lmlsum$coef[[1]],3), "; Slope = ", signif(lmlsum$coef[[2]], 3), "; P = ", signif(lmlsum$coef[2,4],3), cex.sub = 0.1, font.sub = 3))# add sub-title with r-square, etc. In the second line, in particular, I don't know how to express the 'tilde' in rk format. Here's one version of what I've tried, all of which cause a parsing error: echo (' lml <- lm(' + y + \"~\" + x +');\n'); I feel that there's something very elementary that I've missed, but I don't know what it is! Is there a syntax reference that I can consult? best wishes, Peter ---------------------- Peter Mayer Discipline of Politics & International Studies (POLIS) School of History & Politics http://www.arts.adelaide.edu.au/historypolitics/ The University of Adelaide, AUSTRALIA 5005 Ph : +61 8 8313 5609 Fax : +61 8 8313 3443 e-mail: pet...@ad... CRICOS Provider Number 00123M ----------------------------------------------------------- This email message is intended only for the addressee(s) and contains information that may be confidential and/or copyright. If you are not the intended recipient please notify the sender by reply email and immediately delete this email. Use, disclosure or reproduction of this email by anyone other than the intended recipient(s) is strictly prohibited. No representation is made that this email or any attachments are free of viruses. Virus scanning is recommended and is the responsibility of the recipient. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com |