Hi guys,
I need your help with grouping a variable
I have a continuous variable 'budget' which goes from -6847 (negative) to +81204 (positive)
I'm trying to create the groups using the following code (which does what it should when values are positive)
balance_groups <- c(paste(seq(-10000,90000, by=10000), seq(-10000 + 10000 - 1, 100000-1, by=10000),
sep = "-"), paste(100000, "+", sep = ""))
unfortunately the output I am getting from this code is the following:
balance_groups
"-10000--1" "0-9999" "10000-19999" "20000-29999" "30000-39999" "40000-49999" "50000-59999" "60000-69999" "70000-79999" "80000-89999" "90000-99999" "1e+05+"
I tried various variations of the numbers, but I must be doing something wrong as the groups are always incorrect. It's mainly the first group which is wrong. I'd like it to be -10,000 - 0, "1-9999". I tried various combinations but none work!
I would be grateful for your help
Thank you