Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

1. What is meant by Latitudes? 2. What is cartography ?

Answered: 1 week ago