You got those lines because variable Final.Result
in your data frame is factor and not numeric (you can check it with function str()
).
> str(df2)
'data.frame': 66 obs. of 3 variables:
$ Location : Factor w/ 17 levels "BOON KENG RD BLK 6 (DS)",..: 1 1 1 1 1 1 1 1 1 1 ...
$ Parameter : Factor w/ 54 levels "Aluminium","Ammonia (as N)",..: 37 37 37 37 37 37 37 37 37 37 ...
$ Final.Result: Factor w/ 677 levels "< 0.0005","< 0.001",..: 645 644 654 653 647 643 647 647 646 646 ...
Try to convert those values to numeric (as in df2
there is no non numeric values). This will work only for df2 but if your whole data frame has those "< 0.0005","< 0.001"
values, you should decide how to treat them (replace with NA, or some small constant).
df2$Final.Result2<-as.numeric(as.character(df2$Final.Result))
ggplot(df2,aes(x = factor(Location),y=Final.Result2)) + geom_boxplot()