Im trying to make a barplot that, on the y axis, plots proportion (0-1) and lengths on the x axis. So for example, if 20% of the lengths are between 2-2.5 cm the barplot would show this part as 0.20 and so on.
dput of the data:
structure(list(lakeID = c("WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1"), length_mm = c(3.29578034252511,
3.05273143556774, 4.11651463454998, 3.64915075778057, 3.40293442842425,
3.49419270173337, 3.55868041121872, 3.5532652381806, 3.78887694233121,
2.26543334886767, 3.22300479541362, 2.6055853773186, 1.62253226616811,
2.51517074415142, 4.54943800179329, 3.83573407191973, 3.31127333532285,
3.43454223242939, 3.41302451569109, 3.81782572759674, 3.50875800466214,
3.5198361442865, 3.68266994732741, 3.58739450664914, 4.00648407538206,
3.01790704972915, 3.7660371410995, 3.58600929966214, 3.47317479414174,
3.44175638180953, 3.66744274596135, 3.56436642763375, 3.31520591653105,
3.4837444407011, 3.25468169315804, 2.72959821254005, 3.39208340545041,
3.8610995344213, 3.32827780007959, 2.01728012811503, 3.47502213578572,
3.76973316442039, 3.54007401386482, 2.36542915865969, 2.71900635340954,
4.73140205935136, 3.49497322779637, 3.42105089437823, 3.19349256942152,
2.79778086301199, 2.76197770932982, 2.99448523453566, 2.38407599050835,
3.4625157314126, 4.0546330303842, 3.01282923471714, 2.33668590120942,
3.23762174220216, 1.97664874108201, 1.8701076150702, 1.50444083456087,
1.18247137544713, 4.01351080737643, 3.2760528782409, 2.56521515576366,
3.32562658487562, 1.7460772647557, 1.79132700905415, 1.239135253171,
1.74573374720612, 1.87524594613811, 0.912491204318464, 1.78924836867883,
1.91132403902786, 1.31372504816161, 3.52565867997583, 1.52019841654724,
3.0762382997279, 2.07850634362678, 1.61046756357919, 2.99987271075478,
2.52502277887881, 1.86954884131864, 2.01868145441508, 1.8843135461978,
1.98640384325391, 1.97460114550437, 1.31609282746562, 2.93159430788195,
1.69112881431847, 2.55967610751402, 1.51090633046685, 2.37671100748319,
1.16224488247501, 1.53262547603426, 3.83556402973345, 3.53642826386767,
3.78127324937211, 2.07299101627422, 3.53019071345519, 3.90182770254613,
3.08787575374506, 1.52990085037578, 3.90037955082499, 2.2565558620371,
4.51854242424441, 3.96653818987832, 3.0553228289244, 1.50523498814881,
2.433075847495, 4.9763531357055, 2.21948267583181, 1.08405576216065,
2.86578194007227, 1.66585601078225, 3.50022337483117, 3.04363596618875,
1.80290031819779, 2.05147297452008, 1.33298275201269, 1.39737150732298,
1.90535483810053, 2.97764304103634, 3.83913281724215, 2.11593112439339,
2.14539255009432, 1.11302134096302, 1.46939242340364, 1.68423118513666,
2.67103246729496, 0.883670776222353, 0.857731318920019, 2.27688930625684,
1.72708499576553, 1.70413880391224, 1.48558080178839, 2.70492456781409,
2.18441901101861, 1.98369491091683, 2.26528685612998, 2.10446475597905,
0.922905856293783, 2.44140702898097, 3.71804797924049, 1.97211862824641,
4.21934426059672, 4.55163718833441, 3.3354911290314, 4.0330258901133,
3.92540812862449, 3.87613442002371, 1.25597604037201, 1.62588137662832,
1.32037586515379, 1.62537605167888, 1.74420108505589, 1.33342889042086,
1.71451215668238, 2.48501310927965, 1.57984586394021, 4.20037975574274,
3.21817576372289, 1.86875485812735, 1.4957161630253, 3.19548006967573,
3.20006569605806, 4.06852458389361, 1.80543034877443, 1.32574811085723,
3.21129558652425, 2.9289307084175, 1.3217972530302, 1.02217978339846,
0.843961281364767, 3.55573552579727, 1.53832610974739, 1.30536823354944,
1.09005050470486, 1.80404288876501, 1.90208067587203, 3.6786488092955,
1.62984768270009, 3.75848752909307, 2.63562580243312, 3.8607689407216,
2.37489101870941, 3.97728662249668, 4.89460012626031, 3.70641429708999,
4.6313920898078, 5.05153764972689, 2.75328389852147, 3.03617234453789,
2.90155184537041, 4.15086162471282, 3.3773187763031, 4.13570279132253,
3.65656890561342, 3.96625892448904, 4.43585510575654, 1.43700296997979,
4.13846230096255, 3.14724281975585, 3.99561668275935, 1.48029247538492,
3.2725267151395, 4.34898187988026, 6.30485080377601, 1.67012305642895,
2.16509516065924, 4.00672173243297, 1.35471907293165, 3.02527095778283,
1.61320078269852, 1.85293186275904, 2.77705363948908, 3.74059107572172,
2.29147428894724, 2.08952636431853, 2.65057993474746, 1.89356619176391,
2.34623359489188, 2.9461923111907, 4.19818117295273, 3.11437886634752
), date = structure(c(1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800), tzone = "UTC", class = c("POSIXct",
"POSIXt")), year = c(2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L)), row.names = c(NA, -225L), class = c("tbl_df",
"tbl", "data.frame"))
Ive tried this code but have not had any success
props = benthosBx %>%
group_by(length_mm) %>%
summarise(length = n()) %>%
mutate(freq = length_mm / sum(length_mm))
barplot(prop.table(table(props$freq,props$length_mm),margin=1), beside=F)
Any ideas on how to setup the data to make this work?
CodePudding user response:
What you are describing is really just a histogram, except the counts are divided by the total number of observations:
library(ggplot2)
ggplot(benthosBx, aes(x = length_mm))
geom_histogram(aes(y = ..count../nrow(benthosBx)), breaks = seq(0, 7, 0.5),
fill = 'deepskyblue3', color = 'black')
theme_light()
labs(x = "Length (mm)", y = "Proportion", title = "Length distribution")
Or, in base R:
h <- hist(benthosBx$length_mm, breaks = seq(0, 7, 0.5), plot = FALSE)
h$counts <- h$counts / nrow(benthosBx)
plot(h, xlab = 'Length(mm)', ylab = 'Proportion', main = 'Length distribution',
col = 'gray75')
CodePudding user response:
Try these options ...
library(tidyverse)
library(scales)
#>
#> Attaching package: 'scales'
#> The following object is masked from 'package:purrr':
#>
#> discard
#> The following object is masked from 'package:readr':
#>
#> col_factor
data_df <- structure(list(lakeID = c("WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1", "WE1",
"WE1", "WE1", "WE1", "WE1"), length_mm = c(3.29578034252511,
3.05273143556774, 4.11651463454998, 3.64915075778057, 3.40293442842425,
3.49419270173337, 3.55868041121872, 3.5532652381806, 3.78887694233121,
2.26543334886767, 3.22300479541362, 2.6055853773186, 1.62253226616811,
2.51517074415142, 4.54943800179329, 3.83573407191973, 3.31127333532285,
3.43454223242939, 3.41302451569109, 3.81782572759674, 3.50875800466214,
3.5198361442865, 3.68266994732741, 3.58739450664914, 4.00648407538206,
3.01790704972915, 3.7660371410995, 3.58600929966214, 3.47317479414174,
3.44175638180953, 3.66744274596135, 3.56436642763375, 3.31520591653105,
3.4837444407011, 3.25468169315804, 2.72959821254005, 3.39208340545041,
3.8610995344213, 3.32827780007959, 2.01728012811503, 3.47502213578572,
3.76973316442039, 3.54007401386482, 2.36542915865969, 2.71900635340954,
4.73140205935136, 3.49497322779637, 3.42105089437823, 3.19349256942152,
2.79778086301199, 2.76197770932982, 2.99448523453566, 2.38407599050835,
3.4625157314126, 4.0546330303842, 3.01282923471714, 2.33668590120942,
3.23762174220216, 1.97664874108201, 1.8701076150702, 1.50444083456087,
1.18247137544713, 4.01351080737643, 3.2760528782409, 2.56521515576366,
3.32562658487562, 1.7460772647557, 1.79132700905415, 1.239135253171,
1.74573374720612, 1.87524594613811, 0.912491204318464, 1.78924836867883,
1.91132403902786, 1.31372504816161, 3.52565867997583, 1.52019841654724,
3.0762382997279, 2.07850634362678, 1.61046756357919, 2.99987271075478,
2.52502277887881, 1.86954884131864, 2.01868145441508, 1.8843135461978,
1.98640384325391, 1.97460114550437, 1.31609282746562, 2.93159430788195,
1.69112881431847, 2.55967610751402, 1.51090633046685, 2.37671100748319,
1.16224488247501, 1.53262547603426, 3.83556402973345, 3.53642826386767,
3.78127324937211, 2.07299101627422, 3.53019071345519, 3.90182770254613,
3.08787575374506, 1.52990085037578, 3.90037955082499, 2.2565558620371,
4.51854242424441, 3.96653818987832, 3.0553228289244, 1.50523498814881,
2.433075847495, 4.9763531357055, 2.21948267583181, 1.08405576216065,
2.86578194007227, 1.66585601078225, 3.50022337483117, 3.04363596618875,
1.80290031819779, 2.05147297452008, 1.33298275201269, 1.39737150732298,
1.90535483810053, 2.97764304103634, 3.83913281724215, 2.11593112439339,
2.14539255009432, 1.11302134096302, 1.46939242340364, 1.68423118513666,
2.67103246729496, 0.883670776222353, 0.857731318920019, 2.27688930625684,
1.72708499576553, 1.70413880391224, 1.48558080178839, 2.70492456781409,
2.18441901101861, 1.98369491091683, 2.26528685612998, 2.10446475597905,
0.922905856293783, 2.44140702898097, 3.71804797924049, 1.97211862824641,
4.21934426059672, 4.55163718833441, 3.3354911290314, 4.0330258901133,
3.92540812862449, 3.87613442002371, 1.25597604037201, 1.62588137662832,
1.32037586515379, 1.62537605167888, 1.74420108505589, 1.33342889042086,
1.71451215668238, 2.48501310927965, 1.57984586394021, 4.20037975574274,
3.21817576372289, 1.86875485812735, 1.4957161630253, 3.19548006967573,
3.20006569605806, 4.06852458389361, 1.80543034877443, 1.32574811085723,
3.21129558652425, 2.9289307084175, 1.3217972530302, 1.02217978339846,
0.843961281364767, 3.55573552579727, 1.53832610974739, 1.30536823354944,
1.09005050470486, 1.80404288876501, 1.90208067587203, 3.6786488092955,
1.62984768270009, 3.75848752909307, 2.63562580243312, 3.8607689407216,
2.37489101870941, 3.97728662249668, 4.89460012626031, 3.70641429708999,
4.6313920898078, 5.05153764972689, 2.75328389852147, 3.03617234453789,
2.90155184537041, 4.15086162471282, 3.3773187763031, 4.13570279132253,
3.65656890561342, 3.96625892448904, 4.43585510575654, 1.43700296997979,
4.13846230096255, 3.14724281975585, 3.99561668275935, 1.48029247538492,
3.2725267151395, 4.34898187988026, 6.30485080377601, 1.67012305642895,
2.16509516065924, 4.00672173243297, 1.35471907293165, 3.02527095778283,
1.61320078269852, 1.85293186275904, 2.77705363948908, 3.74059107572172,
2.29147428894724, 2.08952636431853, 2.65057993474746, 1.89356619176391,
2.34623359489188, 2.9461923111907, 4.19818117295273, 3.11437886634752
), date = structure(c(1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1502236800,
1502236800, 1502236800, 1502236800, 1502236800, 1502236800, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1505779200, 1505779200, 1505779200, 1505779200, 1505779200, 1505779200,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800, 1506988800,
1506988800, 1506988800, 1506988800, 1506988800, 1506988800), tzone = "UTC", class = c("POSIXct",
"POSIXt")), year = c(2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L, 2017L,
2017L, 2017L, 2017L)), row.names = c(NA, -225L), class = c("tbl_df",
"tbl", "data.frame"))
data_df |>
ggplot(aes(length_mm))
geom_density()
scale_y_continuous(labels = label_percent())
data_df |>
mutate(length_mm = cut_width(length_mm, 1)) |>
count(length_mm) |>
mutate(pct = n / sum(n)) |>
ggplot(aes(length_mm, pct))
geom_col()
scale_y_continuous(labels = label_percent())