Setting ranges for a bar chart in R and displaying count of items
问题 I have created a data frame from iris dataset using the following command: new_iris = data.frame(iris$Species,iris$Sepal.Length) range(iris$Sepal.Length) The second command tells me the range of the Sepal.Length. I want to implement a bar plot using plotly or ggplot2 such that the code decides the ranges of Sepal.Length automatically and then each range contains one bar which gives the count of all the Sepal.Length values in that range. So let's say if the ranges decided are "2-4","4-6","6-8"