I am trying to append new text to an existing column if it fits within the parameters.
Here is the dataset I am working on:
Kod PC1_05 Rank_05 PC1_18 Rank_18 PC_Chg Rank_Chg Zcore_rank_change Status
1 1010110 -1.6952721 21 -1.7914811 10 -0.09620898 -11 -0.2724456 Stable
2 1010120 -1.3518838 67 -1.4729535 59 -0.12106977 -8 -0.1981423 Stable
3 1010130 -0.7793791 138 -0.9511099 114 -0.17173080 -24 -0.5944268 Stable
4 1010140 -0.2219527 192 -0.6900887 145 -0.46813601 -47 -1.1640857 Stable
5 1010201 -1.4540743 55 -1.6195653 41 -0.16549094 -14 -0.3467489 Stable
6 1010210 -1.4193512 57 -1.5769924 43 -0.15764116 -14 -0.3467489 Stable
and trying to filter out the ones above the 70th percentile and append 'accending' to the Status
column.
I tried this below but it seems to change all of the status
columns to 'accending' and not just those above the 70th percentile.
composite_index_merge <- composite_index_merge %>%
mutate(Status = ifelse(PC_Chg > quantile(PC_Chg , c(.70)), Status <- 'Accending', Status))
Aucun commentaire:
Enregistrer un commentaire