If you insert a stargazer table into R Markdown that outputs an HTML file, you may get a p-value note that looks like this:
p<0.1; p<0.05; p<0.01
What should be displayed is this:
*p<0.1; **p<0.05; ***p<0.01
This is the legend for understanding the “stars” in the regression table. What’s happening is the asterisks are being treated as markdown code, which is adding italics and bolding to the note instead of simply showing the asterisks verbatim. (Recall that in Markdown surrounding text with one asterisk adds italics and surrounding text with two asterisks adds bolding.)
To fix this we can add the following two arguments to the stargazer function:
notes.append = FALSE
notes = c("<sup>⋆</sup>p<0.1; <sup>⋆⋆</sup>p<0.05; <sup>⋆⋆⋆</sup>p<0.01")
⋆ is an HTML entity for a star character.
notes.append = FALSE says to NOT append the note but rather replace the existing note. The
notes argument specifies the note we want to add using the
⋆ HTML entity.