1
I am using a database with several dates and would like to sum up the values of the last available date, I can filter the data.frame
by date, but I can’t make the sum of the values, I’m trying to use the function colSums
.
Database link used in csv: https://covid.saude.gov.br/
Code I’m using:
library(tidyverse)
dados <- read_delim("~/Downloads/arquivo_geral.csv",
";", escape_double = FALSE, trim_ws = TRUE)
dados <- dados[,-c(1,4,6)]
soma <- dados %>%
filter(data == max(dados$data)) %>%
select(-grep("obitosAcumulados", colnames(dados))) %>%
colSums(dados[3])
Thank you! It worked perfectly.
– Alexandre Sanches