I wanted to mask any values under 5 in my R dataframe and was looking for a solution to do it in one go for the entire dataframe.
            Asked
            
        
        
            Active
            
        
            Viewed 94 times
        
    0
            
            
        - 
                    Include the data in the question. Also, I think this has been asked before https://stackoverflow.com/questions/26468385/r-replace-all-values-in-a-dataframe-lower-than-a-threshold-with-na and https://stackoverflow.com/questions/54226974/replace-values-greater-than-zero-with-1-in-r are few of the links. – Ronak Shah Sep 17 '21 at 10:31
- 
                    Please provide enough code so others can better understand or reproduce the problem. – Community Sep 18 '21 at 02:00
1 Answers
0
            
            
        Data<- data.frame(
                 Age_band= c("0-14","15-19","20-29","30-39","40-49","50-59","60-69","70-79","80+"),
                 Number_of_participants = c(2,53,31,11,75,35,37,3,12),
                 )
    
    Data[Data<5] = "<5"
    
 
    
    
        FatemehT
        
- 131
- 1
- 6