Hi,
I am trying to sort these dates so that it groups all the same months together, but I am really struggling to do so! I would like to try this using an if-else loop Below is an example of what I kind of need the output to look like.
01 who was CEO
01
01
02
02
etc...
Here is the code I have:
rm(list = ls())
setwd("~/Desktop/researchprofpopper")
library(tidyverse)
library(sandwich)
library(stargazer)
library(ggplot2)
library(dplyr)
library(lubridate)
options(scipen = 9)
cse = function(reg) {
rob = sqrt(diag(vcovHC(reg, type = "HC1")))
return(rob)
}
prac08 <- read.csv("prac08.csv", header=TRUE, sep=",")
prac08 <- prac08 %>%
mutate(DateStartRole=ifelse(DateStartRole=="N", NA, DateStartRole)) %>%
mutate(DateStartRole = as.Date(DateStartRole, "%Y%m%d"))
df %>%
mutate(month = format(date, "%m"), year = format(date, "%Y")) %>%
group_by(month, year) %>%
summarise(total = sum(value))