I am new in R-world and now I am trying to set a certain text if a condition is fulfilled. I have a dataframe of different restaurants (df_Restaurant) and there is column with the Name of the restaurant (Name) and other with the Risk of being infected (Risk). All the restaurants with the same name, have the same risk. The original dataframe does not have the Risk values in every case, so I want to fulfill this condition. Apart of that, the value cannot be 0.
I got some errors, but first I want to know if the way I wrote this condition is correct. Is there any other way to replace the value of a cell in case of being text? The df Restaurant has over 200.000 rows and I do not know other way.
Errors shown are: 1- Object 'j' not found 2- Unexpected error in }
if (Restaurant$Name[i]==locales$Name[j] & Restaurant[i]!=0) { Restaurant$Risk[i]= Restaurant$Risk[j]}
Thank you in advance
Aucun commentaire:
Enregistrer un commentaire