#using spread of data to determine (descriptive) position within the dataset
code is the following:
jobs_df <- jobs_df %>%
mutate(description = if_else(quan_value < 'q1' , "Lowest",
if_else(quan_value < 'q2', "Low",
if_else(quan_value < 'q3' , "Medium",
if_else(quan_value < 'q4' , "High",
if_else(quan_value < 'q5', "Highest", NA_character_))))))
where "description" for each row in the dataframe should be lowest, low, medium, high, highest and q1, q2, q3, q4, q5 refer to quintile values for the spread of data for "quan_value" column
dataframe is as follows (jobs_df):
jobs quan_value q1 q2 q3 q4 q5
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Banker 1.3 2 4 6 8 1
2 Accountant 2.4 2 4 6 8 1
3 Waiter 4.2 2 4 6 8 1
4 Barista 6.3 2 4 6 8 1
5 Train driver 9.1 2 4 6 8 1
"description" is the new column I want based on the if_else statement, however it mostly just retruns "Medium" as the result