[R] barplot - easy for experienced, difficult for me

Jim Lemon jim at bitwrit.com.au
Wed Oct 2 01:07:24 CEST 2013


On 10/01/2013 07:32 PM, happyR wrote:
> hey lobachevsky - thanks!
>
> but: Error in barplot.default (matrix, col = c("yellow","purple"), beside = TRUE) :
>    'height' must be a vector or a matrix
>
> what to do? :)
>
First, one must always avoid confusing the general case with a specific 
instance. If you were standing by the side of the Coolgardie-Esperance 
Highway, as I once was, trying to thumb a ride across the Nullarbor, it 
would be a crushing disappointment if the driver who pulled over offered 
to take humanity all the way to Ceduna.

You have accomplished something similar in the above example. "matrix" 
is the sort of object that you want to pass to "barplot", not the 
specific matrix named "spineless" that was specially prepared for you. 
You are, in a sense, requesting that poor old "barplot" illustrate the 
function that turns various sorts of things into matrices. Sorry, 
happyR, it just doesn't compute.

Lobachevsky



More information about the R-help mailing list