The goal of pmev is to implement project management tracking metrics as outlined in the Project Management Body of Knowledge (PMBOK) manual which can be found .
You can install the development version of pmev from GitHub with:
# install.packages("devtools")
::install_github("david-hammond/pmev") devtools
library(pmev)
data(project)
= earned_value(start = project$start,
ev end = project$end,
progress = project$progress,
planned_cost = project$planned_cost,
project_value = 150000,
cost_to_date = 10000,
date = "2024-07-03")
The Earned Value can then be plotted in the following way.
library(ggplot2)
library(dplyr)
library(lubridate)
= data.frame(date = ev$pv$end, type = 'Planned Value', value = ev$pv$planned_value)
pvalue = rbind(pvalue[1,] %>% mutate(type = "Earned Value"), data.frame(date = ev$ev$date,
evalue type = 'Earned Value',
value = ev$ev$earned_value))
= rbind(pvalue[1,] %>% mutate(type = "Actual Cost"), data.frame(date = ev$ev$date,
ac type = 'Actual Cost',
value = ev$ev$actual_cost))
= pvalue %>% rbind(evalue) %>% rbind(ac)
evalue = ggplot(evalue, aes(date, value, colour = type)) + geom_line(linewidth = 1.5) +
p scale_y_continuous(labels = scales::dollar, name = "Total Value",
sec.axis = sec_axis(~ . / max(pvalue$value),
labels = scales::label_percent())) +
labs(colour = "", title = "Earned Value Chart", x = "") + theme_bw() +
theme(legend.position = c(0.8, 0.2)) +
geom_vline(xintercept = ev$ev$date, linetype = "dashed", color = "cornflowerblue") +
annotate("text", x = ev$ev$date + days(1), y = max(evalue$value),
label = "Today", hjust = 0, vjust = 1.5, color = "cornflowerblue")
p