# Create new column with rounded values

I am trying to create a new column in this dataset. I would like to have rating to be 1, 2, 3, 4 or 5 instead of 1.25, 2.00, 3.75, ..., 5.00. Can you help me? The only solution I found is this

chocolate$Rat = gsub("1.25", "1", chocolate$Rating)


but I know it is not a good way to work. Is there something faster which can to the work efficiently? Thanks

• Do you want 3.75 as 3 or 4…? – BlackCurrant May 23 at 14:57
• If possible, 4. but If you can only round to 3 it's not a problem – user96624 May 23 at 15:00
• I want to use it to learn about associative rules and test how it works. I have an example with "titanic" dataset and I think this dataset could also work. My idea is to see the combinations which lead to "rating =1, rating =2, rating=3, rating=4, rating=5" with the apriori() algorithm – user96624 May 23 at 15:04
• Just google round in r. – BlackCurrant May 23 at 15:18
• Also, I am thinking about using this new column to build a decisional tree. Do you think it could work? – user96624 May 23 at 15:18