Skip to content

Remove NAs from Barplot

2 messages · Doran, Harold, Marc Schwartz (via MN)

#
On Wed, 2005-08-24 at 13:06 -0400, Doran, Harold wrote:
Harold,

Get rid of the 'format(tot)' in your text() call:

text(math.barplot, graph.max+5, tot, xpd = TRUE, 
     col = c("blue", "orange"))


By using format(tot), you are coercing the values to text. Thus:
[,1] [,2] [,3] [,4] [,5] [,6]
math.bar  "NA" "NA" "NA" "NA" "55" "48"
apmxpmeet "47" "50" "49" "50" "49" "46"

versus:
[,1] [,2] [,3] [,4] [,5] [,6]
math.bar    NA   NA   NA   NA   55   48
apmxpmeet   47   50   49   50   49   46


In the first case, text() will draw "NA", whereas in the second, the NA
is ignored.

Also, your code above is not entirely reproducible, since:
Error: Object "tmp" not found


HTH,

Marc Schwartz