I have columns that denote intervals and some of these entries are in scientific notation and seemingly out of order. It looks like this:
(500,500] (1.4e+04,1.45e+03] (750,800] (600,650] (1.2e+03,1.25e+03]
column column column column column
Ideally, I want all my column names in decimal notation, i.e.:
(500,500] (1400,1450] (750,800] (600,650] (1200,1250]
column column column column column
I have added the columns by using:
df <- df %>% mutate(ind = cut(mean_entry, breaks = c(-Inf, c(0, seq(100, 2000,by = 50 )))),
col_name = ind, n = 1) %>%pivot_wider(names_from = ind, values_from = n, values_fill= list(n = 0))
Does anyone know how I can do that? I'd like to avoid hard-coding every applicable column name but please let me know if that's the only way forward. I don't have package preferences and appreciate any insight.
Thanks!