I am using the following code. Its running but no output is shown (AND NO errors)
library(dplyr)
library(purrr)
library(readr)
library(ggplot2)
library(tidyverse)
files <- list.files(path = "my directory", pattern = "*.csv", full.names = TRUE)
redflag <-
map_dfr(files,read_csv,
col_types = cols_only(
C = col_character(),
I = col_double(),
J = col_double(),
L = col_double(),
V = col_double(),
W = col_double()
)
) %>%
mutate(month = months.Date(as.Date(C)),
month = factor(month, levels = month.name)) %>%
group_by(month) %>%
summarize(trend.I = sum(I, na.rm = T),
trend.J = sum(J, na.rm = T),
trend.L = sum(L, na.rm = T),
trend.V = sum(V, na.rm = T),
trend.W = sum(W, na.rm = T)) %>%
melt(id.var = 'month') %>%
ggplot(aes(x = month, y = value, fill = variable)) +
geom_bar(aes(x = month, y = value, fill = variable), stat = "identity", position = "dodge") +
theme_classic() + ylab("Value") + xlab("Month") + ggtitle("Monthly trend of data") +
geom_text(aes(label = value), hjust=1, vjust=1, size=3,position = position_dodge(width = 1))