install.packages("googlesheets4") library(googlesheets4) library(dplyr) library(lubridate) library(ggplot2)
cloud_costs <- read_sheet("https://docs.google.com/spreadsheets/u/1/d/1NPCld7RMAnjmzZCJp8-I9lFQCFjL8uJyEa16fZa_Q68/edit?usp=drive_open&ouid=114651845902974533993") unique(cloud_costs$cluster_name) unique(cloud_costs$cluster_location)
unique(cloud_costs$namespace) unique(cloud_costs$resource_name)
cloud_costs %>% group_by(resource_name) %>% mutate(ccost = mean(cost)) cloud_costs$start_date <- as.Date(cloud_costs$usage_start_time)
cloud_costs$date_diff <- as.Date(as.character(cloud_costs$usage_end_time))- as.Date(as.character(cloud_costs$usage_start_time))
total_cloud_costs <- sum(cloud_costs$cost) total_cloud_costs
visualizeCosts <- ggplot(cloud_costs, aes(x=namespace, y=cost)) + geom_bar(stat="identity",, fill = "#0072B2") +coord_flip() + xlab("Difference between start and end date") visualizeCosts