You can manually adjust the breaks inside hist if you save it to an object. Here is and example using the faithful dataset
Note: I don't have enough reputation to show the graphs the code produces
waiting.hist <- hist(faithful$waiting)
edit: Since the breaks do not change the counts, you will have to update the counts too. Otherwise the counts will be recycled
waiting.hist$breaks <- seq(40, 100, 2.5)
waiting.hist$counts <- table(cut(faithful$waiting, seq(40, 100, 2.5)))
plot(waiting.hist)
Or you could use ggplot2 and specify the breaks using bins or binwidth
library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 3.6.3
#> Warning: package 'ggplot2' was built under R version 3.6.3
#> Warning: package 'tibble' was built under R version 3.6.3
#> Warning: package 'tidyr' was built under R version 3.6.3
#> Warning: package 'purrr' was built under R version 3.6.3
#> Warning: package 'dplyr' was built under R version 3.6.3
#> Warning: package 'forcats' was built under R version 3.6.3
faithful %>%
ggplot(aes(x = waiting)) +
geom_histogram(bins = 30)
faithful %>%
ggplot(aes(x = waiting)) +
geom_histogram(binwidth = 2.5)
Created on 2020-09-05 by the reprex package (v0.3.0)