[R] Barplot with lines
Jim Lemon
jim at bitwrit.com.au
Sat Nov 24 00:11:54 CET 2012
On 11/24/2012 02:21 AM, skanap wrote:
>
> Hi Jim,
>
> Thank you for the reply. But, when I use Barpos I get this error.
>
> plot(mydata$score,barpos)
> Error in xy.coords(x, y, xlabel, ylabel, log) :
> 'x' and 'y' lengths differ
>
> I need all the points in x-axis that are in 'days' column. If I'm selecting
> only points in val1 and val2 I'm missing rows for score. Thanks again!
>
Hi SK,
If you want to get all bars and lines displayed, you can substitute
zeros for the missing values in val1 and val2. Then your "empty bars"
will have zero height and your "barpos" will have all the _x_ values you
need. In the above you are using barpos as the _y_ values.
However, looking at Greg's solution, it is probably better in the
general case of missing values.
Jim
More information about the R-help
mailing list