New to R and I need help please

I am asked to check the data I have to see if all categories are properly named. You might have to rename a category if you find inconsistencies.

this is the data that I have for the categorical variabel prime_genre:

levels(prime_genre)
[1] "Book" "Business" "Catalogs" "Education" "Entertainment" "Finance" "Food & Drink"
[8] "Games" "Health & Fitness" "Health and Fitness" "Lifestyle" "Medical" "Music" "Navigation"
[15] "News" "Photo & Video" "Productivity" "Reference" "Shopping" "Social Networking" "Sports"
[22] "Travel" "Utilities" "Weather"

I need to rename health and fitness, "health & fitness" because it appears twice.
I know that I need to use a function similar to the one below as we have learned in class (library(reshape)).
apple_store=rename(apple_store,c(Health_and_Fitness= "Health & Fitness"))
unfortunately it does not work since prime_genre is a categorical variable and a column while health an fitness is a category or level of this variable.

Look at forcats package collapse function and see if that would work for you.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Will do thank you for your suggestion!