How to plot for repeating values in R

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to plot for repeating values in R

aman54kumar
I am trying to implement an array in R but plotting same y-values for all x values. If value is NA, then it shouldn't be plotted.

 I tried the following plot which shows the histogram for all 10 values.
plot(c(1,2,NA,3,4,5,3,NA,2,4),type='h', ylim=c(0,4))

However, for the case below, when I try to control the y-values, the repeated values are not considered in the plot.
plot(c(1,2,NA,3,4,5,3,NA,2,4), rep(1,10),type='h', ylim=c(0,4))

Is this possible with plot function? Please suggest if the same can be done with an alternative.