I have a quite simple R code, which seems not to be working as expected.
library(RColorBrewer)
library(ggplot2)
library(data.table)
library(tidyverse)
file <- fread(file)
file$V1 <- NULL
data <- file %>%
select(col_a, col_b, col_c) %>%
group_by(col_a, col_b) %>%
mutate(sum = sum(col_c))
Some data that could be relevant:
Classes ‘data.table’ and 'data.frame': 148195407 obs. of 3 variables: $ col_a : int 85888 11111 99999 85888 11111 99999 85888 11111 99999 85888 ... $ col_b : chr "aaa" "bbb" "ccc" "aaa" ... $ col_c: int 4352 4352 52896 4352 48960 48960 48960 4352 27539 4352 ...
PROBLEM: It is not grouping the data according to col_a and col_b