While legend() is of course appropriate for legends, there is a general solution for all text. The trick is that the pos option not only sets the position of the text relative to the current location but it also sets justification. Above and Below are center justified. Setting pos to 2 makes the text right justified. When it is set to the right of the position (pos?=?4) then it is left justified.
Replace your text code with...
text(1.5, 150, paste("Mean =", round(MyMean, 1), "
Median =",
round(MyMedian, 1), "
Std.Dev =", round(MySd, 1)), pos = 4)
for left justified and...
text(5.0, 150, paste("Mean = ", round(MyMean, 1), "
Median = ",
round(MyMedian, 1), "
Std.Dev = ", round(MySd, 1), sep = ''), pos = 2)
for right justified.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…