[R] Help

Martin Møller Skarbiniks Pedersen tr@xp|@yer @end|ng |rom gm@||@com
Sun Feb 4 19:01:23 CET 2024


On Sun, 4 Feb 2024 at 17:26, Jibrin Alhassan <jibrin.alhassan using unn.edu.ng> wrote:
>
> Here is the script I used to plot the graph indicating the text I wanted to
> insert. The line in the script that I have issues with is: text(-8,-8,
> "R^2=  0.62",  r = 0.79, N = 161", cex = 2
> R^2=  0.62 is not producing R squared = 0.62.
> Thanks.

This works for me:

curve(dnorm, from=-3, to=3, main="Normal Distribution")
text(x=0, y=0.1, cex=1.5, expression(R^2 == 0.62))

if you are used to write expression using LaTeX math , then maybe you
like the latex2exp package:
curve(dnorm, from=-3, to=3, main="Normal Distribution")
text(0, 0.1, latex2exp::TeX("$R^2 = 0.62$"))

Regards
Martin



More information about the R-help mailing list