How to output \wedge in R?

Viewed 58

How can I output the wedge symbol in R?

For example if I wanted C ∧ W, I might use $ \wedge $ in LaTeX. This is helpful when I have to use R to write a factor structure diagram.

1 Answers

The wedge operator is apparently not included in the R ?plotmath functionality. You can do this with a Unicode symbol, although it could conceivably be sensitive to the fonts available on your system/for a particular output format. (To figure out the appropriate code I did a web search for "Unicode wedge" and found e.g. the wikipedia page; see also here)

png("wedge.png")
plot(0:1,0:1, type="n", ann=FALSE,axes=FALSE)
text(0.5, 0.5, "A \u2227 B", cex=5)
dev.off()

A wedge B

If you want to go for the full-blown LaTeX solution you can use the tikzDevice package:

library(tikzDevice)
tikz("wedge.tex", standAlone = TRUE)
plot(0:1,0:1, type="n", ann=FALSE,axes=FALSE)
text(0.5, 0.5, "$A \\wedge B$", cex=5)
dev.off()
system("pdflatex wedge; pdfcrop wedge.pdf; convert wedge-crop.pdf wedge2.png")

A wedge B

Related