The sigma symbol is missing in quote(sum(x[i]^2, i == 1, n))

II tried this example in "R for Data Science": Chapter 22 (Chapter 22 - Graphics for communication):

df <- tibble(
x = runif(10),
y = runif(10)
)
ggplot(df, aes(x, y)) +
geom_point() +
labs(
x = quote(sum(x[i]^2, i == 1, n)),
y = quote(alpha + beta + frac(delta, theta))
)

On the output, the sigma (summation) symbol is missing and replaced with a rectangle in the x-axis. What is the problem? I am using RStudio of 2013.03.0 build and R of version 4.2.2. I remembered it worked fine with an older version of R some months ago.

Thanks in anticipation.

I found that I had this issue also ...
I spent some time messing with fonts via extrafonts package , installing them etc; but not sure it is relevant to the core issue.
Ultimately I found that the Sigma didnt render correctly when Rstudio used the default or windows graphics device. Going to Rstudio Tools > Global Options > General > Graphics and setting the device either to Cairo or AGG worked for me.
Note that ; For those options to be available you would need to install the Cairo or ragg packages

Thanks for your reply. Could it be a bug in the newer version of RStudio or R. I didn't have this problem when I first ran the example a few months ago. The Sigma render correctly.

[quote="nirgrahamuk, post:2, topic:163426"]
In Rstudio, selecting the Tools > Global Options > General > Graphics, and change the device from default to Cairo works for me too.

I suspect the new version of RStudio. It is rendering okay in Ubuntu 22.04, R 4.2.3 & RStudio 2022.07.2+576 "Spotted Wakerobin"

I read that base::grDevices provides Cairo-based graphic functions. Why can't quote() uses them automatically in rendering Sigma symbol? Excuse my naivety here.

In RStudio, setting the backend to AGG from default in Tools > Global Options > General > Graphics also works for me. As I read further, {ggplot2} depends on {ragg} for rendering graphics, and will install {ragg} automatically as a dependency. So both Cairo and AGG are available in the system. By right there should be no problem in displaying Sigma....

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.