Question: #R Programming I have read CSV file into a dataframe(df). I need to extract a column genre which has two or three items in a

#R Programming

I have read CSV file into a dataframe(df). I need to extract a column genre which has two or three items in a row with a comma in between. (e.g: Drama, History, Romance) or (Drama, History) or (Drama, Drama, Horror)

I have used code :

df <- na.omit(df). #for removing nan values

Genre <- unique(unlist(strsplit(as.character(df$Genre), ","))). # to separate genre between comma(,)

Now, I need to get rid of repeated genres from Genre.(e.g: change (Drama, Drama, Horror) to

Drama

Horror

,

I have tried using duplicated(Genre) but since the type of "Genre" is a character it will give you False as an output. I need to print a list of unique genres in the dataset.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!