2025-03-24
## Warning: package 'ggplot2' was built under R version 4.4.3
## Warning: package 'plotly' was built under R version 4.4.3
## ## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2': ## ## last_plot
## The following object is masked from 'package:stats': ## ## filter
## The following object is masked from 'package:graphics': ## ## layout
## Warning: package 'dplyr' was built under R version 4.4.3
## ## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats': ## ## filter, lag
## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union
As a computer science student, I measure my productivty by the number of lines of code that I write per day when I have a coding project to submit. This presentation explores the concepts of mean, median, and mode using a sample dataset of the lines of code written over the week.
The mean is the average:
\[ \text{Mean} = \frac{\sum x_i}{n} \] \[ \text{Median} = \begin{cases} x_{\left(\frac{n+1}{2}\right)}, & \text{if } n \text{ is odd} \\ \frac{1}{2} \left( x_{\left(\frac{n}{2}\right)} + x_{\left(\frac{n}{2} + 1\right)} \right), & \text{if } n \text{ is even} \end{cases} \]
The median is the middle value after data is sorted.
Lastly, the mode is the most frequently occuring data point or value.
## [1] 120 90 130 107 140 230 130
## [1] 135.2857
## [1] 130
## [1] 130
ggplot(data.frame(loc), aes(x=loc)) + geom_histogram(binwidth = 20, fill = "#8C1D40", color= "pink") + labs(title="Histogram of Lines of Code Per Day", x = "Lines of Code", y = "Frequency")