Skip to content
Prev 174754 / 398506 Next

Barplot With Selected X-Axis Region

Gundala Viswanath wrote:
You need to change

dat$V1 >= -500 && dat$V1 <=500

to

dat$V1 >= -500 & dat$V1 <=500

and read about the difference between & and &&.


So probably you want something like:

   subsetdat <- dat[dat$V1 >= -500 & dat$V1 <=500,]
   barplot(subsetdat$V2, names.arg=subsetdat$V1)

Uwe Ligges