I have a data frame, which looks like:
pr class
0,317 1
0,579 3
0,317 1
0,426 2
9,851 7
0,992 3
3,731 5
1,909 4
0,426 2
9,851 7
3,731 5
9,851 7
I need to change probability if it is not equal to particular value in the particular class. For example, if the class is 1 and the probability is not 0.317, I need to change it to 0.317.
I tried to use for one class for-loop and if-statement but for some reason it didn't work at all.
for(class in data_frame) {
if(data_frame$class = 1) {
data_frame$pr = 0.317
}
}
I tried only with one class because I don't have any idea how I can do it for all classes in one code (may be another for-loop?).
Thanks a lot in advance!
Aucun commentaire:
Enregistrer un commentaire