Thanks. Lets supouse these are my data
library(tidyverse)
my_data <- tibble(Var_1 = c(900, 1500, 350, 1200, 750, 100),
my_weights = c(2.2, 3.1, 8.2, 4.2, 5.3, 6.8))
The correct way to proceed would be use the "raw" data to create the histogram like here?
ggplot(my_data, aes(Var_1, weight = my_weights,
))+
geom_histogram()
Or should I create a new weighted variable first and then use it in the plot like here:
my_data %>%
mutate(Var_1_weighted = Var_1 * my_weights) -> my_data
ggplot(my_data, aes(Var_1_weighted, weight = my_weights,
))+
geom_histogram()