In the R programming language, “mtcars” refers to a built-in dataset that contains information about various car models and their specifications. This dataset is often used for data analysis and statistical modeling. You can access this dataset in R by simply typing mtcars in the R console, and it will display the dataset’s contents.
#ANIME dataset
data=read.csv("C://Users//Jammi Spandana//OneDrive//Documents//Book1.csv")
data
## Rank Name
## 1 1 Demon Slayer: Kimetsu no Yaiba - Entertainment District Arc
## 2 2 Fruits Basket the Final Season
## 3 3 Mo Dao Zu Shi 3
## 4 4 Fullmetal Alchemist: Brotherhood
## 5 5 Attack on Titan 3rd Season: Part II
## 6 6 Jujutsu Kaisen
## 7 7 Attack on Titan The Final Season: Part II
## 8 8 Attack on Titan The Final Season
## 9 9 Demon Slayer: Kimetsu no Yaiba Movie - Mugen Train
## 10 10 Haikyuu!! Karasuno High School vs Shiratorizawa Academy
## 11 11 your name.
## 12 12 Haikyuu!! Second Season
## 13 13 Demon Slayer: Kimetsu no Yaiba
## 14 14 Hunter x Hunter (2011)
## 15 15 A Silent Voice
## 16 16 Violet Evergarden Movie
## 17 17 Haikyuu!! To the Top: Part II
## 18 18 Heaven Official's Blessing Special
## 19 19 That Time I Got Reincarnated as a Slime Season 2
## 20 20 Given
## 21 21 Code Geass: Lelouch of the Rebellion R2
## 22 22 Mo Dao Zu Shi 2
## 23 23 Gintama: The Very Final
## 24 24 Link Click
## 25 25 Mob Psycho 100 II
## 26 26 Haikyuu!! To the Top
## 27 27 Fruits Basket 2nd Season
## 28 28 The Promised Neverland
## 29 29 Spirited Away
## 30 30 That Time I Got Reincarnated as a Slime Season 2: Part II
## 31 31 Heaven Official's Blessing
## 32 32 Ranking of Kings
## 33 33 Mushoku Tensei: Jobless Reincarnation - Part II
## 34 34 Gintama.: Shirogane no Tamashii-hen 2
## 35 35 Clannad After Story
## 36 36 Mo Dao Zu Shi
## 37 37 Gintama': Enchousen
## 38 38 Banana Fish
## 39 39 Douluo Dalu 2
## 40 40 Gintama Kanketsu-hen: Yorozuya yo Eien Nare
## 41 41 Gintama.
## 42 42 Gintama.: Shirogane no Tamashii-hen
## 43 43 Attack on Titan 3rd Season
## 44 44 Steins;Gate
## 45 45 Haikyuu!!
## 46 46 Gintama'
## 47 47 One-Punch Man
## 48 48 Demon Slayer: Kimetsu no Yaiba - Mugen Train
## 49 49 Gintama°
## 50 50 Howl's Moving Castle
## 51 51 Natsume's Book of Friends Season 6
## 52 52 JoJo's Bizarre Adventure: Golden Wind
## 53 53 JoJo's Bizarre Adventure: Stone Ocean
## 54 54 Vinland Saga
## 55 55 Natsume's Book of Friends Season 4
## 56 56 Assassination Classroom 2nd Season
## 57 57 Natsume's Book of Friends Season 5
## 58 58 My Hero Academia 3
## 59 59 Violet Evergarden
## 60 60 That Time I Got Reincarnated as a Slime
## 61 61 My Hero Academia 2
## 62 62 Wolf Children
## 63 63 SK8 the Infinity
## 64 64 Hajime no Ippo: The Fighting!
## 65 65 Code Geass: Lelouch of the Rebellion
## 66 66 JoJo’s Bizarre Adventure: Stardust Crusaders - Battle in Egypt
## 67 67 Yona of the Dawn: Zeno Arc
## 68 68 JoJo's Bizarre Adventure: Diamond is Unbreakable
## 69 69 Kamisama Kiss: Kako-hen
## 70 70 Hajime no Ippo: New Challenger
## 71 71 Mushishi Zoku Shou 2nd Season
## 72 72 Attack on Titan
## 73 73 Haikyuu!! Tokushuu! Harukou Volley ni Kaketa Seishun
## 74 74 Kaguya-sama: Love Is War?
## 75 75 Gintama: Porori-hen
## 76 76 March Comes in like a Lion 2nd Season
## 77 77 Natsume's Book of Friends Season 3
## 78 78 Attack on Titan 2nd Season
## 79 79 I Want to Eat Your Pancreas
## 80 80 Rascal Does Not Dream of a Dreaming Girl
## 81 81 Given Movie
## 82 82 Mushishi Zoku Shou
## 83 83 Princess Mononoke
## 84 84 Kuroko's Basketball 3
## 85 85 BTS: We are Bulletproof - the Eternal
## 86 86 Haikyuu!! Movie 4: Battle of Concepts
## 87 87 Dr. Stone
## 88 88 Attack on Titan: No Regrets
## 89 89 Horimiya
## 90 90 Cowboy Bebop
## 91 91 Hotarubi no Mori e
## 92 92 The Disastrous Life of Saiki K. 2nd Season
## 93 93 Monogatari Series: Second Season
## 94 94 Castlevania Season 4
## 95 95 Doukyuusei
## 96 96 ERASED
## 97 97 The Rising of the Shield Hero
## 98 98 To Your Eternity
## 99 99 Hajime no Ippo: Rising
## 100 100 Josee, the Tiger and the Fish
## Japanese_name Type Episodes
## 1 Kimetsu no Yaiba: Yuukaku-hen TV NA
## 2 Fruits Basket the Final TV 13
## 3 The Founder of Diabolism 3 Web 12
## 4 Hagane no Renkinjutsushi: Full Metal Alchemist TV 64
## 5 Shingeki no Kyojin Season 3: Part II TV 10
## 6 TV 24
## 7 Shingeki no Kyojin The Final Season: Part II TV NA
## 8 Shingeki no Kyojin The Final Season TV 16
## 9 Kimetsu no Yaiba Movie: Mugen Ressha-hen Movie NA
## 10 Haikyuu!! Karasuno Koukou vs Shiratorizawa Gakuen Koukou TV 10
## 11 Kimi no Na wa. Movie NA
## 12 TV 25
## 13 Kimetsu no Yaiba TV 26
## 14 TV 148
## 15 Koe no Katachi Movie NA
## 16 Movie NA
## 17 TV 12
## 18 Tian Guan Ci Fu Special Web 1
## 19 Tensei Shitara Slime Datta Ken Season 2 TV 12
## 20 TV 11
## 21 Code Geass: Hangyaku no Lelouch R2 TV 25
## 22 The Founder of Diabolism 2 Web 8
## 23 Gintama: The Final Movie NA
## 24 Shiguang Dailiren Web 11
## 25 TV 13
## 26 TV 13
## 27 TV 25
## 28 Yakusoku no Neverland TV 12
## 29 Sen to Chihiro no Kamikakushi Movie NA
## 30 Tensei Shitara Slime Datta Ken Season 2: Part II TV 12
## 31 Tian Guan Ci Fu Web 11
## 32 Ousama Ranking TV NA
## 33 Mushoku Tensei: Isekai Ittara Honki Dasu - Part II TV 12
## 34 Gintama: Silver Soul Arc 2 TV 14
## 35 TV 24
## 36 The Founder of Diabolism Web 15
## 37 TV 13
## 38 TV 24
## 39 Soul Land 2 Web 16
## 40 Gintama The Movie: The Final Chapter - Be Forever Yorozuya Movie NA
## 41 TV 12
## 42 Gintama: Silver Soul Arc TV 12
## 43 Shingeki no Kyojin 3rd Season TV 12
## 44 TV 24
## 45 TV 25
## 46 TV 51
## 47 TV 12
## 48 Kimetsu no Yaiba: Mugen Ressha-hen TV NA
## 49 TV 51
## 50 Howl no Ugoku Shiro Movie NA
## 51 Natsume Yuujinchou Roku TV 11
## 52 JoJo no Kimyou na Bouken: Ougon no Kaze TV 39
## 53 Jojo no Kimyou na Bouken: Stone Ocean Web 12
## 54 TV 24
## 55 Natsume Yuujinchou Shi TV 13
## 56 Ansatsu Kyoushitsu 2nd Season TV 25
## 57 Natsume Yuujinchou Go TV 11
## 58 Boku no Hero Academia 3 TV 25
## 59 TV 13
## 60 Tensei Shitara Slime Datta Ken TV 24
## 61 Boku no Hero Academia 2 TV 25
## 62 Ookami Kodomo no Ame to Yuki Movie NA
## 63 TV 12
## 64 Fighting Spirit TV 75
## 65 Code Geass: Hangyaku no Lelouch TV 25
## 66 JoJo no Kimyou na Bouken: Stardust Crusaders - Egypt-hen TV 24
## 67 Akatsuki no Yona: Zeno Arc OVA 2
## 68 JoJo no Kimyou na Bouken: Diamond wa Kudakenai TV 39
## 69 Kamisama Hajimemashita: Kako-hen OVA 4
## 70 Fighting Spirit: New Challenger TV 26
## 71 Mushishi -Next Passage- 2nd Season TV 10
## 72 Shingeki no Kyojin TV 25
## 73 OVA 1
## 74 Kaguya-sama wa Kokurasetai? Tensai-tachi no Renai Zunousen TV 12
## 75 Gintama: Slip Arc TV 13
## 76 3-gatsu no Lion 2nd Season TV 22
## 77 Natsume Yuujinchou San TV 13
## 78 Shingeki no Kyojin 2nd Season TV 12
## 79 Kimi no Suizou wo Tabetai Movie NA
## 80 Seishun Buta Yarou wa Yumemiru Shoujo no Yume wo Minai Movie NA
## 81 Movie NA
## 82 Mushishi -Next Passage- TV 10
## 83 Mononoke Hime Movie NA
## 84 Kuroko no Basket 3 TV 25
## 85 Music NA
## 86 Haikyuu!! Movie 4: Concept no Tatakai Movie NA
## 87 TV 24
## 88 Shingeki no Kyojin: Kuinaki Sentaku OVA 2
## 89 TV 13
## 90 TV 26
## 91 To the Forest of Firefly Lights Movie NA
## 92 Saiki Kusuo no Psi Nan 2nd Season TV 24
## 93 TV 26
## 94 Web 10
## 95 Doukyuusei -Classmates- Movie NA
## 96 Boku dake ga Inai Machi TV 12
## 97 Tate no Yuusha no Nariagari TV 25
## 98 Fumetsu no Anata e TV 20
## 99 Fighting Spirit: Rising TV 25
## 100 Josee to Tora to Sakana-tachi Movie NA
## Studio Release_season
## 1 ufotable Fall
## 2 TMS Entertainment Spring
## 3 B.C MAY PICTURES
## 4 Bones Spring
## 5 WIT Studio Spring
## 6 MAPPA Fall
## 7 MAPPA Winter
## 8 MAPPA Winter
## 9 ufotable
## 10 Production I.G Fall
## 11 CoMix Wave Films
## 12 Production I.G Fall
## 13 ufotable Spring
## 14 MADHOUSE Fall
## 15 Kyoto Animation
## 16 Kyoto Animation
## 17 Production I.G Fall
## 18 Haoliners Animation League
## 19 8-Bit Winter
## 20 Lerche Summer
## 21 Sunrise Spring
## 22 B.C MAY PICTURES
## 23 BN Pictures
## 24 Studio LAN
## 25 Bones Winter
## 26 Production I.G Winter
## 27 8 Pan Spring
## 28 CloverWorks Winter
## 29 Studio Ghibli
## 30 8-Bit Summer
## 31 Haoliners Animation League
## 32 WIT Studio Fall
## 33 Studio Bind Fall
## 34 BN Pictures Summer
## 35 Kyoto Animation Fall
## 36 B.C MAY PICTURES
## 37 Sunrise Fall
## 38 MAPPA Summer
## 39 Sparkly Key Animation Studio
## 40 Sunrise
## 41 BN Pictures Winter
## 42 BN Pictures Winter
## 43 WIT Studio Summer
## 44 WHITE FOX Spring
## 45 Production I.G Spring
## 46 Sunrise Spring
## 47 MADHOUSE Fall
## 48 ufotable Fall
## 49 BN Pictures Spring
## 50 Studio Ghibli
## 51 Shuka Spring
## 52 David Production Fall
## 53 David Production Fall
## 54 WIT Studio Summer
## 55 Brain's Base Winter
## 56 Lerche Winter
## 57 Shuka Fall
## 58 Bones Spring
## 59 Kyoto Animation Winter
## 60 8-Bit Fall
## 61 Bones Spring
## 62 Studio Chizu
## 63 Bones Winter
## 64 MADHOUSE Fall
## 65 Sunrise Fall
## 66 David Production Winter
## 67 Pierrot
## 68 David Production Spring
## 69 TMS Entertainment
## 70 MADHOUSE Winter
## 71 Artland Fall
## 72 WIT Studio Spring
## 73 Production I.G
## 74 A-1 Pictures Spring
## 75 BN Pictures Fall
## 76 SHAFT Fall
## 77 Brain's Base Summer
## 78 WIT Studio Spring
## 79 Studio VOLN
## 80 CloverWorks
## 81 Lerche
## 82 Artland Spring
## 83 Studio Ghibli
## 84 Production I.G Winter
## 85 Studio Pivote
## 86 Production I.G
## 87 8 Pan Summer
## 88 WIT Studio
## 89 CloverWorks Winter
## 90 Sunrise Spring
## 91 Brain's Base
## 92 J.C.Staff Winter
## 93 SHAFT Summer
## 94 Tiger Animation Spring
## 95 A-1 Pictures
## 96 A-1 Pictures Winter
## 97 Kinema Citrus Winter
## 98 Brain's Base Spring
## 99 MADHOUSE Fall
## 100 Bones
## Tags
## 1 Action, Adventure, Fantasy, Shounen, Demons, Historical, Martial Arts, Orphans, Siblings, Swordplay, Based on a Manga, Explicit Violence
## 2 Drama, Fantasy, Romance, Shoujo, Animal Transformation, Contemporary Fantasy, Curse, Dysfunctional Families, Mental Illness, Orphans, Based on a Manga, Emotional Abuse,, Mature Themes,, Physical Abuse,, Suicide,, Violence,, Domestic Abuse
## 3 Fantasy, Ancient China, Chinese Animation, Cultivation, Xianxia, Based on a Web Novel
## 4 Action, Adventure, Drama, Fantasy, Mystery, Shounen, Conspiracy, Death of a Loved One, Military, Siblings, Based on a Manga, Animal Abuse,, Mature Themes,, Violence,, Domestic Abuse
## 5 Action, Fantasy, Horror, Shounen, Dark Fantasy, Isolated Society, Military, Outside World, Post-apocalyptic, Based on a Manga, Cannibalism,, Explicit Violence
## 6 Action, Horror, Shounen, Curse, Exorcists, Monsters, School Life, Supernatural, Based on a Manga, Explicit Violence
## 7 Action, Drama, Fantasy, Horror, Shounen, Dark Fantasy, Military, War, Based on a Manga
## 8 Action, Drama, Fantasy, Horror, Shounen, Dark Fantasy, Military, War, Based on a Manga, Explicit Violence,, Mature Themes,, Physical Abuse,, Suicide
## 9 Action, Drama, Fantasy, Shounen, Demons, Historical, Martial Arts, Orphans, Siblings, Swordplay, Trains, Based on a Manga, Mature Themes,, Suicide,, Violence
## 10 Shounen, Sports, Animeism, School Club, School Life, Tournaments, Volleyball, Based on a Manga
## 11 Drama, Romance, Body Swapping, Gender Bender, Opposites Attract, School Life, Supernatural, Original Work
## 12 Shounen, Sports, School Club, School Life, Tournaments, Volleyball, Based on a Manga
## 13 Action, Adventure, Comedy, Drama, Fantasy, Shounen, Death of a Loved One, Demons, Historical, Martial Arts, Orphans, Siblings, Swordplay, Based on a Manga, Violence
## 14 Action, Adventure, Drama, Fantasy, Shounen, Monsters, Superpowers, Based on a Manga, Violence
## 15 Drama, Shounen, Disability, Melancholy, Mental Illness, School Life, Based on a Manga, Bullying,, Mature Themes,, Suicide
## 16 Drama, Melancholy, War, Based on a Light Novel, Violence
## 17 Shounen, Sports, Animeism, School Club, Tournaments, Volleyball, Based on a Manga
## 18 BL, Romance, Shounen-ai, Afterlife, Ancient China, Chinese Animation, Demon King, Ghosts, Gods, Interspecies Relationship, Non-Human Protagonists, Opposites Attract, Royalty, Supernatural, Xianxia, Based on a Web Novel
## 19 Action, Adventure, Fantasy, Shounen, Cheats, Demons, Isekai, Kingdom Building, Magic, Management, Modern Knowledge, Monsters, Person in a Strange World, Political, Reincarnation, RPG, Slimes, Based on a Manga
## 20 BL, Drama, Romance, Shounen-ai, Death of a Loved One, Music, noitaminA, Based on a Manga, Mature Themes,, Suicide
## 21 Mecha, Sci Fi, Conspiracy, Mind Games, Overpowered Main Characters, Political, Psychological, Real Robot, Rebellions, Rivalries, Royalty, Secret Identity, Superpowers, Terrorism, Original Work
## 22 Action, Fantasy, Mystery, Ancient China, Chinese Animation, Cultivation, Historical, Martial Arts, Overpowered Main Characters, Supernatural, Swordplay, War, Xianxia, Zombies, Based on a Web Novel, Violence
## 23 Action, Comedy, Drama, Sci Fi, Shounen, Aliens, Feudal Japan, Gag, Parody, Samurai, Swordplay, Based on a Manga, Violence
## 24 Drama, Fantasy, Chinese Animation, Contemporary Fantasy, Superpowers, Time Travel, Urban Fantasy, Original Work, Violence
## 25 Action, Comedy, Exorcists, Psychic Powers, Psychological, School Life, Supernatural, Superpowers, Based on a Manga, Violence
## 26 Shounen, Sports, Animeism, School Club, Tournaments, Volleyball, Based on a Manga
## 27 Comedy, Drama, Fantasy, Romance, Shoujo, Animal Transformation, Contemporary Fantasy, Curse, Dysfunctional Families, Love Triangle, Mental Illness, Orphans, Based on a Manga, Bullying,, Emotional Abuse,, Mature Themes,, Physical Abuse,, Domestic Abuse
## 28 Fantasy, Horror, Mystery, Sci Fi, Shounen, Dark Fantasy, Isolated Society, Mind Games, noitaminA, Orphans, Outside World, Psychological, Thriller, Based on a Manga, Mature Themes,, Domestic Abuse,, Self-Harm
## 29 Adventure, Fantasy, Curse, Family Friendly, Japanese Mythology, Magic, Person in a Strange World, Youkai, Original Work
## 30 Action, Adventure, Fantasy, Shounen, Cheats, Demons, Isekai, Kingdom Building, Magic, Management, Modern Knowledge, Monsters, Person in a Strange World, Political, Reincarnation, RPG, Slimes, Based on a Manga, Physical Abuse
## 31 Action, BL, Comedy, Drama, Romance, Shounen-ai, Afterlife, Ancient China, Chinese Animation, Demon King, Demons, Ghosts, Gods, Heaven, Historical, Interspecies Relationship, Non-Human Protagonists, Opposites Attract, Religion, Royalty, Supernatural, Xianxia, Based on a Web Novel, Bullying,, Violence
## 32 Action, Adventure, Fantasy, Coming of Age, Disability, Royalty, Based on a Manga, Violence
## 33 Action, Adventure, Drama, Fantasy, Romance, Demons, Isekai, Magic, NEET, Person in a Strange World, Reincarnation, Based on a Light Novel, Mature Themes,, Violence
## 34 Action, Comedy, Drama, Sci Fi, Shounen, Aliens, Crude, Feudal Japan, Gag, Samurai, Slapstick, Swordplay, Based on a Manga
## 35 Drama, Romance, Adult Couples, Coming of Age, Family Life, Illness, Based on a Visual Novel, Drug Use,, Mature Themes
## 36 Action, Adventure, Mystery, Ancient China, Chinese Animation, Cultivation, Historical, Rebellions, Supernatural, Swordplay, War, Xianxia, Zombies, Based on a Web Novel, Violence
## 37 Action, Comedy, Drama, Sci Fi, Shounen, Aliens, Crude, Feudal Japan, Gag, Parody, Samurai, Slapstick, Swordplay, Based on a Manga
## 38 Action, Drama, Shoujo, America, Criminals, Gangs, noitaminA, Based on a Manga, Drug Use,, Mature Themes,, Physical Abuse,, Prostitution,, Sexual Abuse,, Violence
## 39 Action, Fantasy, Chinese Animation, Cultivation, Xianxia, Based on a Web Novel, CG Animation
## 40 Action, Comedy, Drama, Sci Fi, Shounen, Aliens, Feudal Japan, Samurai, Swordplay, Time Travel, Based on a Manga
## 41 Action, Comedy, Drama, Sci Fi, Shounen, Aliens, Crude, Feudal Japan, Gag, Samurai, Slapstick, Swordplay, Based on a Manga
## 42 Action, Comedy, Drama, Sci Fi, Shounen, Aliens, Crude, Feudal Japan, Gag, Samurai, Slapstick, Swordplay, Based on a Manga
## 43 Action, Fantasy, Horror, Dark Fantasy, Isolated Society, Military, Outside World, Political, Post-apocalyptic, Based on a Manga, Cannibalism,, Explicit Violence
## 44 Sci Fi, Conspiracy, LGBT Themes, Psychological, Thriller, Time Travel, Based on a Visual Novel, Mature Themes,, Suicide
## 45 Shounen, Sports, School Club, School Life, Tournaments, Volleyball, Based on a Manga
## 46 Action, Comedy, Drama, Sci Fi, Shounen, Aliens, Breaking the Fourth Wall, Crude, Feudal Japan, Gag, Parody, Samurai, Slapstick, Swordplay, Based on a Manga
## 47 Action, Comedy, Sci Fi, Seinen, Cyborgs, Monsters, Overpowered Main Characters, Parody, Satire, Superheroes, Superpowers, Based on a Manga, Explicit Violence
## 48 Action, Drama, Fantasy, Shounen, Demons, Historical, Orphans, Siblings, Swordplay, Trains, Based on a Manga, Mature Themes,, Suicide,, Violence
## 49 Action, Comedy, Drama, Sci Fi, Shounen, Aliens, Breaking the Fourth Wall, Crude, Feudal Japan, Gag, Parody, Samurai, Slapstick, Swordplay, Based on a Manga
## 50 Adventure, Fantasy, Romance, Curse, Family Friendly, Lifestyle Change, Magic, Witches, Based on a Novel
## 51 Drama, Fantasy, Shoujo, Bodyguards, Cats, Countryside, Episodic, Iyashikei, Japanese Mythology, Orphans, Supernatural, Youkai, Based on a Manga
## 52 Action, Adventure, Shounen, Europe, Italy, Supernatural, Based on a Manga, Animal Abuse,, Mature Themes
## 53 Action, Adventure, Shounen, America, Prison, Supernatural, Based on a Manga
## 54 Action, Seinen, Death of a Loved One, England, Europe, Historical, Medieval, Revenge, Swordplay, War, Weak to Strong, Based on a Manga, Violence
## 55 Drama, Shoujo, Slice of Life, Bodyguards, Cats, Countryside, Episodic, Iyashikei, Japanese Mythology, Orphans, Supernatural, Youkai, Based on a Manga
## 56 Action, Comedy, Sci Fi, Shounen, Assassins, Non-Human Protagonists, Overpowered Main Characters, Parody, School Life, Teaching, Based on a Manga
## 57 Drama, Shoujo, Slice of Life, Bodyguards, Cats, Countryside, Episodic, Iyashikei, Japanese Mythology, Orphans, Supernatural, Youkai, Based on a Manga
## 58 Action, Comedy, Drama, Sci Fi, Shounen, Superheroes, Superpowers, Based on a Manga, Violence
## 59 Drama, Lifestyle Change, Melancholy, War, Based on a Light Novel, Violence
## 60 Action, Adventure, Comedy, Fantasy, Shounen, Cheats, Demons, Isekai, Kingdom Building, Magic, Management, Modern Knowledge, Monsters, Non-Human Protagonists, Overpowered Main Characters, Person in a Strange World, Political, Reincarnation, RPG, Slimes, Based on a Manga, Violence
## 61 Action, Comedy, Drama, Sci Fi, Shounen, School Life, Superheroes, Superpowers, Tournaments, Weak to Strong, Based on a Manga, Emotional Abuse,, Mature Themes,, Physical Abuse,, Violence,, Domestic Abuse
## 62 Fantasy, Slice of Life, Animal Characteristics, Animal Transformation, Childcare, Coming of Age, Contemporary Fantasy, Countryside, Death of a Loved One, Family Life, Lifestyle Change, Single Parent, Werewolves, Original Work, Nudity
## 63 Comedy, Sports, Racing, Original Work, Emotional Abuse,, Mature Themes,, Physical Abuse,, Domestic Abuse
## 64 Action, Drama, Shounen, Sports, Boxing, Hand to Hand Combat, Weak to Strong, Based on a Manga
## 65 Mecha, Sci Fi, Conspiracy, Mind Games, Overpowered Main Characters, Political, Psychological, Real Robot, Rebellions, Revenge, Rivalries, Royalty, Secret Identity, Superpowers, Terrorism, Original Work, Nudity,, Violence
## 66 Action, Adventure, Comedy, Shounen, Monster-of-the-week, Proxy Battles, Supernatural, Based on a Manga, Animal Abuse,, Explicit Violence,, Mature Themes
## 67 Action, Adventure, Drama, Fantasy, Romance, Shoujo, Death of a Loved One, Orphans, Political, Royalty, Based on a Manga, Violence
## 68 Action, Mystery, Shounen, Proxy Battles, Supernatural, Based on a Manga, Animal Abuse,, Mature Themes,, Violence
## 69 Comedy, Romance, Shoujo, Animal Characteristics, Interspecies Relationship, Japanese Mythology, Master-Servant Relationship, Non-Human Protagonists, Based on a Manga
## 70 Action, Drama, Shounen, Sports, Boxing, Hand to Hand Combat, Tournaments, Based on a Manga
## 71 Fantasy, Seinen, Episodic, Iyashikei, Supernatural, Based on a Manga
## 72 Action, Fantasy, Horror, Shounen, Dark Fantasy, Death of a Loved One, Isolated Society, Military, Outside World, Overpowered Main Characters, Post-apocalyptic, Revenge, Based on a Manga, Cannibalism,, Explicit Violence,, Mature Themes,, Suicide
## 73 Shounen, Sports, Recap, Volleyball, Based on a Manga
## 74 Comedy, Drama, Romance, Seinen, Episodic, Love Confession, Mind Games, School Life, Student Council, Based on a Manga
## 75 Action, Comedy, Drama, Sci Fi, Shounen, Aliens, Crude, Feudal Japan, Gag, Samurai, Slapstick, Swordplay, Based on a Manga
## 76 Drama, Seinen, Slice of Life, Board Games, Melancholy, Orphans, Psychological, Based on a Manga, Bullying,, Emotional Abuse
## 77 Drama, Shoujo, Slice of Life, Bodyguards, Cats, Countryside, Episodic, Iyashikei, Japanese Mythology, Orphans, Supernatural, Youkai, Based on a Manga
## 78 Action, Fantasy, Horror, Shounen, Dark Fantasy, Isolated Society, Military, Outside World, Overpowered Main Characters, Post-apocalyptic, Based on a Manga, Cannibalism,, Explicit Violence
## 79 Drama, Romance, Seinen, Coming of Age, Illness, Opposites Attract, School Life, Based on a Novel
## 80 Drama, Romance, Illness, Senpai-Kouhai Relationship, Supernatural, Time Travel, Based on a Light Novel
## 81 BL, Drama, Romance, Shounen-ai, Adult Couples, Codependency, Love Triangle, Mature Romance, Music, Based on a Manga, Emotional Abuse,, Mature Themes,, Physical Abuse,, Sexual Abuse,, Sexual Content
## 82 Fantasy, Seinen, Episodic, Iyashikei, Supernatural, Based on a Manga
## 83 Action, Adventure, Fantasy, Curse, Environmental, Feudal Japan, Forest, Japanese Mythology, Royalty, Original Work
## 84 Shounen, Sports, Basketball, School Club, Tournaments, Based on a Manga
## 85 Chibi, Korean Animation
## 86 Shounen, Sports, Recap, School Club, Tournaments, Volleyball, Based on a Manga
## 87 Adventure, Comedy, Sci Fi, Shounen, Person in a Strange World, Post-apocalyptic, Prehistoric, Survival, Based on a Manga
## 88 Action, Fantasy, Shoujo, Dark Fantasy, Isolated Society, Military, Outside World, Post-apocalyptic, Based on a Manga, Cannibalism,, Explicit Violence
## 89 Comedy, Romance, Shounen, Romantic Comedy, School Life, Based on a Manga
## 90 Action, Adventure, Drama, Sci Fi, Bounty Hunters, Episodic, Noir, Outer Space, Western, Original Work, Drug Use,, Mature Themes,, Nudity,, Violence
## 91 Drama, Romance, Shoujo, Coming of Age, Forest, Japanese Mythology, Loneliness, Melancholy, Supernatural, Youkai, Based on a Manga
## 92 Comedy, Shounen, Slice of Life, Breaking the Fourth Wall, Gag, Psychic Powers, School Life, Supernatural, Superpowers, Based on a Manga
## 93 Action, Comedy, Drama, Ecchi, Mystery, Romance, Supernatural, Tsundere, Based on a Light Novel, Explicit Violence
## 94 Action, Adventure, Drama, Horror, 15th Century, Europe, Historical, Magic, Medieval, Supernatural, Vampires, Based on a Video Game, Animal Abuse,, Explicit Violence,, Mature Themes,, Suicide
## 95 BL, Drama, Romance, Shounen-ai, All-Boys School, LGBT Themes, Opposites Attract, School Life, Based on a Manga
## 96 Drama, Mystery, Seinen, Age Transformation, Crime, Death of a Loved One, Dysfunctional Families, Melancholy, noitaminA, Serial Killers, Supernatural, Thriller, Time Travel, Based on a Manga, Animal Abuse,, Mature Themes,, Physical Abuse,, Domestic Abuse
## 97 Action, Adventure, Drama, Fantasy, Seinen, Animal Characteristics, Betrayal, Dark Fantasy, Demons, Framed for a Crime, Isekai, Monsters, Person in a Strange World, RPG, Summoned Into Another World, Based on a Light Novel, Violence
## 98 Adventure, Drama, Fantasy, Shounen, Animal Transformation, Melancholy, Non-Human Protagonists, Supernatural, Survival, Based on a Manga, Violence
## 99 Action, Drama, Shounen, Sports, Boxing, Hand to Hand Combat, Based on a Manga
## 100 Drama, Romance, Disability, Based on a Novel
## Rating Release_year End_year
## 1 4.60 2021 NA
## 2 4.60 2021 NA
## 3 4.58 2021 NA
## 4 4.58 2009 2010
## 5 4.57 2019 NA
## 6 4.56 2020 2021
## 7 4.56 2022 NA
## 8 4.55 2020 2021
## 9 4.54 2020 NA
## 10 4.53 2016 NA
## 11 4.51 2016 NA
## 12 4.51 2015 2016
## 13 4.51 2019 NA
## 14 4.51 2011 2014
## 15 4.51 2016 NA
## 16 4.50 2020 NA
## 17 4.50 2020 NA
## 18 4.50 2021 NA
## 19 4.48 2021 NA
## 20 4.48 2019 NA
## 21 4.47 2008 NA
## 22 4.46 2019 NA
## 23 4.46 2021 NA
## 24 4.46 2021 NA
## 25 4.46 2019 NA
## 26 4.46 2020 NA
## 27 4.45 2020 NA
## 28 4.45 2019 NA
## 29 4.45 2001 NA
## 30 4.45 2021 NA
## 31 4.45 2020 2021
## 32 4.45 2021 NA
## 33 4.45 2021 NA
## 34 4.44 2018 NA
## 35 4.44 2008 2009
## 36 4.44 2018 NA
## 37 4.44 2012 2013
## 38 4.44 2018 NA
## 39 4.44 2018 NA
## 40 4.44 2013 NA
## 41 4.44 2017 NA
## 42 4.44 2018 NA
## 43 4.44 2018 NA
## 44 4.44 2011 NA
## 45 4.43 2014 NA
## 46 4.43 2011 2012
## 47 4.43 2015 NA
## 48 4.43 2021 NA
## 49 4.43 2015 2016
## 50 4.43 2004 NA
## 51 4.43 2017 NA
## 52 4.43 2018 2019
## 53 4.42 2021 NA
## 54 4.42 2019 NA
## 55 4.40 2012 NA
## 56 4.40 2016 NA
## 57 4.40 2016 NA
## 58 4.40 2018 NA
## 59 4.39 2018 NA
## 60 4.39 2018 2019
## 61 4.39 2017 NA
## 62 4.39 2012 NA
## 63 4.38 2021 NA
## 64 4.38 2000 2002
## 65 4.38 2006 2007
## 66 4.37 2015 NA
## 67 4.37 2016 NA
## 68 4.37 2016 NA
## 69 4.37 2015 2016
## 70 4.37 2009 NA
## 71 4.37 2014 NA
## 72 4.37 2013 NA
## 73 4.37 2017 NA
## 74 4.37 2020 NA
## 75 4.36 2017 NA
## 76 4.36 2017 2018
## 77 4.36 2011 NA
## 78 4.36 2017 NA
## 79 4.36 2018 NA
## 80 4.36 2019 NA
## 81 4.36 2020 NA
## 82 4.36 2014 NA
## 83 4.36 1997 NA
## 84 4.36 2015 NA
## 85 4.36 2020 NA
## 86 4.36 2017 NA
## 87 4.36 2019 NA
## 88 4.36 2014 2015
## 89 4.36 2021 NA
## 90 4.36 1998 1999
## 91 4.36 2011 NA
## 92 4.36 2018 NA
## 93 4.36 2013 NA
## 94 4.35 2021 NA
## 95 4.35 2016 NA
## 96 4.35 2016 NA
## 97 4.35 2019 NA
## 98 4.35 2021 NA
## 99 4.35 2013 2014
## 100 4.35 2020 NA
‘anime’ is a sample data.
#a. and b. structure and summary of the data
str(data)#structure
## 'data.frame': 100 obs. of 11 variables:
## $ Rank : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Name : chr "Demon Slayer: Kimetsu no Yaiba - Entertainment District Arc" "Fruits Basket the Final Season" "Mo Dao Zu Shi 3" "Fullmetal Alchemist: Brotherhood" ...
## $ Japanese_name : chr " Kimetsu no Yaiba: Yuukaku-hen" " Fruits Basket the Final" " The Founder of Diabolism 3" " Hagane no Renkinjutsushi: Full Metal Alchemist" ...
## $ Type : chr "TV " "TV " "Web " "TV " ...
## $ Episodes : int NA 13 12 64 10 24 NA 16 NA 10 ...
## $ Studio : chr "ufotable" "TMS Entertainment" "B.C MAY PICTURES" "Bones" ...
## $ Release_season: chr "Fall " "Spring" "" "Spring" ...
## $ Tags : chr "Action, Adventure, Fantasy, Shounen, Demons, Historical, Martial Arts, Orphans, Siblings, Swordplay, Based on a"| __truncated__ "Drama, Fantasy, Romance, Shoujo, Animal Transformation, Contemporary Fantasy, Curse, Dysfunctional Families, Me"| __truncated__ "Fantasy, Ancient China, Chinese Animation, Cultivation, Xianxia, Based on a Web Novel" "Action, Adventure, Drama, Fantasy, Mystery, Shounen, Conspiracy, Death of a Loved One, Military, Siblings, Base"| __truncated__ ...
## $ Rating : num 4.6 4.6 4.58 4.58 4.57 4.56 4.56 4.55 4.54 4.53 ...
## $ Release_year : int 2021 2021 2021 2009 2019 2020 2022 2020 2020 2016 ...
## $ End_year : int NA NA NA 2010 NA 2021 NA 2021 NA NA ...
summary(data)#summary
## Rank Name Japanese_name Type
## Min. : 1.00 Length:100 Length:100 Length:100
## 1st Qu.: 25.75 Class :character Class :character Class :character
## Median : 50.50 Mode :character Mode :character Mode :character
## Mean : 50.50
## 3rd Qu.: 75.25
## Max. :100.00
##
## Episodes Studio Release_season Tags
## Min. : 1.00 Length:100 Length:100 Length:100
## 1st Qu.: 12.00 Class :character Class :character Class :character
## Median : 13.00 Mode :character Mode :character Mode :character
## Mean : 20.64
## 3rd Qu.: 25.00
## Max. :148.00
## NA's :22
## Rating Release_year End_year
## Min. :4.350 Min. :1997 Min. :1999
## 1st Qu.:4.360 1st Qu.:2014 1st Qu.:2011
## Median :4.430 Median :2018 Median :2015
## Mean :4.426 Mean :2016 Mean :2014
## 3rd Qu.:4.460 3rd Qu.:2020 3rd Qu.:2018
## Max. :4.600 Max. :2022 Max. :2021
## NA's :81
#conversion functions
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.1
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# Example 1: Convert a column to a different data type (e.g., from character to numeric)
my_data <- as.numeric(data$Total)
my_data
## numeric(0)
# Example 2: Convert a column to a factor
my_data <- as.factor(data$Category)
my_data
## factor()
## Levels:
# After performing the desired conversion and transformation operations, you can view the modified data frame:
str(my_data)
## Factor w/ 0 levels:
dplyr is an R package for efficient data manipulation.
It offers easy-to-use functions like filtering, sorting, and summarizing
data, following tidy data principles for analysis.
#c.head of the data
head(data)
## Rank Name
## 1 1 Demon Slayer: Kimetsu no Yaiba - Entertainment District Arc
## 2 2 Fruits Basket the Final Season
## 3 3 Mo Dao Zu Shi 3
## 4 4 Fullmetal Alchemist: Brotherhood
## 5 5 Attack on Titan 3rd Season: Part II
## 6 6 Jujutsu Kaisen
## Japanese_name Type Episodes
## 1 Kimetsu no Yaiba: Yuukaku-hen TV NA
## 2 Fruits Basket the Final TV 13
## 3 The Founder of Diabolism 3 Web 12
## 4 Hagane no Renkinjutsushi: Full Metal Alchemist TV 64
## 5 Shingeki no Kyojin Season 3: Part II TV 10
## 6 TV 24
## Studio Release_season
## 1 ufotable Fall
## 2 TMS Entertainment Spring
## 3 B.C MAY PICTURES
## 4 Bones Spring
## 5 WIT Studio Spring
## 6 MAPPA Fall
## Tags
## 1 Action, Adventure, Fantasy, Shounen, Demons, Historical, Martial Arts, Orphans, Siblings, Swordplay, Based on a Manga, Explicit Violence
## 2 Drama, Fantasy, Romance, Shoujo, Animal Transformation, Contemporary Fantasy, Curse, Dysfunctional Families, Mental Illness, Orphans, Based on a Manga, Emotional Abuse,, Mature Themes,, Physical Abuse,, Suicide,, Violence,, Domestic Abuse
## 3 Fantasy, Ancient China, Chinese Animation, Cultivation, Xianxia, Based on a Web Novel
## 4 Action, Adventure, Drama, Fantasy, Mystery, Shounen, Conspiracy, Death of a Loved One, Military, Siblings, Based on a Manga, Animal Abuse,, Mature Themes,, Violence,, Domestic Abuse
## 5 Action, Fantasy, Horror, Shounen, Dark Fantasy, Isolated Society, Military, Outside World, Post-apocalyptic, Based on a Manga, Cannibalism,, Explicit Violence
## 6 Action, Horror, Shounen, Curse, Exorcists, Monsters, School Life, Supernatural, Based on a Manga, Explicit Violence
## Rating Release_year End_year
## 1 4.60 2021 NA
## 2 4.60 2021 NA
## 3 4.58 2021 NA
## 4 4.58 2009 2010
## 5 4.57 2019 NA
## 6 4.56 2020 2021
# Load the stringr package to use str_detect
library(stringr)
## Warning: package 'stringr' was built under R version 4.3.1
# e) Use pattern matching to filter text
pattern_matched_data <- data %>%
filter(str_detect(Rank, "Professional Advising"))
# Print pattern matched data
print("Pattern Matched Data:")
## [1] "Pattern Matched Data:"
print(pattern_matched_data)
## [1] Rank Name Japanese_name Type Episodes
## [6] Studio Release_season Tags Rating Release_year
## [11] End_year
## <0 rows> (or 0-length row.names)
The stringr package is an R package that provides a set
of functions for working with strings, making string manipulation and
pattern matching more convenient and intuitive.
# h) View the structure and summary of the given data
str(data)
## 'data.frame': 100 obs. of 11 variables:
## $ Rank : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Name : chr "Demon Slayer: Kimetsu no Yaiba - Entertainment District Arc" "Fruits Basket the Final Season" "Mo Dao Zu Shi 3" "Fullmetal Alchemist: Brotherhood" ...
## $ Japanese_name : chr " Kimetsu no Yaiba: Yuukaku-hen" " Fruits Basket the Final" " The Founder of Diabolism 3" " Hagane no Renkinjutsushi: Full Metal Alchemist" ...
## $ Type : chr "TV " "TV " "Web " "TV " ...
## $ Episodes : int NA 13 12 64 10 24 NA 16 NA 10 ...
## $ Studio : chr "ufotable" "TMS Entertainment" "B.C MAY PICTURES" "Bones" ...
## $ Release_season: chr "Fall " "Spring" "" "Spring" ...
## $ Tags : chr "Action, Adventure, Fantasy, Shounen, Demons, Historical, Martial Arts, Orphans, Siblings, Swordplay, Based on a"| __truncated__ "Drama, Fantasy, Romance, Shoujo, Animal Transformation, Contemporary Fantasy, Curse, Dysfunctional Families, Me"| __truncated__ "Fantasy, Ancient China, Chinese Animation, Cultivation, Xianxia, Based on a Web Novel" "Action, Adventure, Drama, Fantasy, Mystery, Shounen, Conspiracy, Death of a Loved One, Military, Siblings, Base"| __truncated__ ...
## $ Rating : num 4.6 4.6 4.58 4.58 4.57 4.56 4.56 4.55 4.54 4.53 ...
## $ Release_year : int 2021 2021 2021 2009 2019 2020 2022 2020 2020 2016 ...
## $ End_year : int NA NA NA 2010 NA 2021 NA 2021 NA NA ...
summary(data)
## Rank Name Japanese_name Type
## Min. : 1.00 Length:100 Length:100 Length:100
## 1st Qu.: 25.75 Class :character Class :character Class :character
## Median : 50.50 Mode :character Mode :character Mode :character
## Mean : 50.50
## 3rd Qu.: 75.25
## Max. :100.00
##
## Episodes Studio Release_season Tags
## Min. : 1.00 Length:100 Length:100 Length:100
## 1st Qu.: 12.00 Class :character Class :character Class :character
## Median : 13.00 Mode :character Mode :character Mode :character
## Mean : 20.64
## 3rd Qu.: 25.00
## Max. :148.00
## NA's :22
## Rating Release_year End_year
## Min. :4.350 Min. :1997 Min. :1999
## 1st Qu.:4.360 1st Qu.:2014 1st Qu.:2011
## Median :4.430 Median :2018 Median :2015
## Mean :4.426 Mean :2016 Mean :2014
## 3rd Qu.:4.460 3rd Qu.:2020 3rd Qu.:2018
## Max. :4.600 Max. :2022 Max. :2021
## NA's :81
#mtcars dataset
data("mtcars")
mtcars
## mpg cyl disp hp drat wt qsec vs am gear carb
## Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
## Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
## Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
## Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
## Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
## Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1
## Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4
## Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2
## Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2
## Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4
## Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4
## Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3
## Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3
## Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3
## Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4
## Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4
## Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4
## Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
## Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
## Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
## Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1
## Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2
## AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2
## Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4
## Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2
## Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1
## Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2
## Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2
## Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4
## Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6
## Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8
## Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2
summary(mtcars)
## mpg cyl disp hp
## Min. :10.40 Min. :4.000 Min. : 71.1 Min. : 52.0
## 1st Qu.:15.43 1st Qu.:4.000 1st Qu.:120.8 1st Qu.: 96.5
## Median :19.20 Median :6.000 Median :196.3 Median :123.0
## Mean :20.09 Mean :6.188 Mean :230.7 Mean :146.7
## 3rd Qu.:22.80 3rd Qu.:8.000 3rd Qu.:326.0 3rd Qu.:180.0
## Max. :33.90 Max. :8.000 Max. :472.0 Max. :335.0
## drat wt qsec vs
## Min. :2.760 Min. :1.513 Min. :14.50 Min. :0.0000
## 1st Qu.:3.080 1st Qu.:2.581 1st Qu.:16.89 1st Qu.:0.0000
## Median :3.695 Median :3.325 Median :17.71 Median :0.0000
## Mean :3.597 Mean :3.217 Mean :17.85 Mean :0.4375
## 3rd Qu.:3.920 3rd Qu.:3.610 3rd Qu.:18.90 3rd Qu.:1.0000
## Max. :4.930 Max. :5.424 Max. :22.90 Max. :1.0000
## am gear carb
## Min. :0.0000 Min. :3.000 Min. :1.000
## 1st Qu.:0.0000 1st Qu.:3.000 1st Qu.:2.000
## Median :0.0000 Median :4.000 Median :2.000
## Mean :0.4062 Mean :3.688 Mean :2.812
## 3rd Qu.:1.0000 3rd Qu.:4.000 3rd Qu.:4.000
## Max. :1.0000 Max. :5.000 Max. :8.000
str(mtcars)
## 'data.frame': 32 obs. of 11 variables:
## $ mpg : num 21 21 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 ...
## $ cyl : num 6 6 4 6 8 6 8 4 4 6 ...
## $ disp: num 160 160 108 258 360 ...
## $ hp : num 110 110 93 110 175 105 245 62 95 123 ...
## $ drat: num 3.9 3.9 3.85 3.08 3.15 2.76 3.21 3.69 3.92 3.92 ...
## $ wt : num 2.62 2.88 2.32 3.21 3.44 ...
## $ qsec: num 16.5 17 18.6 19.4 17 ...
## $ vs : num 0 0 1 1 0 1 0 1 1 1 ...
## $ am : num 1 1 1 0 0 0 0 0 0 0 ...
## $ gear: num 4 4 4 3 3 3 3 4 4 4 ...
## $ carb: num 4 4 1 1 2 1 4 2 2 4 ...
is.null(mtcars)
## [1] FALSE
mtcars is an in-built dataset of rstudio. no null values are there in this dataset.
selecting specific columns using select function:
# Select the mpg and cyl columns
mtcars_select <- select(mtcars, mpg, cyl)
mtcars_select
## mpg cyl
## Mazda RX4 21.0 6
## Mazda RX4 Wag 21.0 6
## Datsun 710 22.8 4
## Hornet 4 Drive 21.4 6
## Hornet Sportabout 18.7 8
## Valiant 18.1 6
## Duster 360 14.3 8
## Merc 240D 24.4 4
## Merc 230 22.8 4
## Merc 280 19.2 6
## Merc 280C 17.8 6
## Merc 450SE 16.4 8
## Merc 450SL 17.3 8
## Merc 450SLC 15.2 8
## Cadillac Fleetwood 10.4 8
## Lincoln Continental 10.4 8
## Chrysler Imperial 14.7 8
## Fiat 128 32.4 4
## Honda Civic 30.4 4
## Toyota Corolla 33.9 4
## Toyota Corona 21.5 4
## Dodge Challenger 15.5 8
## AMC Javelin 15.2 8
## Camaro Z28 13.3 8
## Pontiac Firebird 19.2 8
## Fiat X1-9 27.3 4
## Porsche 914-2 26.0 4
## Lotus Europa 30.4 4
## Ford Pantera L 15.8 8
## Ferrari Dino 19.7 6
## Maserati Bora 15.0 8
## Volvo 142E 21.4 4
filtering the data through filter function using a condition:
# Filter for cars with more than 6 cylinders
mtcars_filter <- filter(mtcars, cyl > 6)
mtcars_filter
## mpg cyl disp hp drat wt qsec vs am gear carb
## Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
## Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4
## Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3
## Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3
## Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3
## Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4
## Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4
## Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4
## Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2
## AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2
## Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4
## Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2
## Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4
## Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8
sorting using arrange function:
# Arrange the dataset by descending mpg
mtcars_arrange <- arrange(mtcars, desc(mpg))
mtcars_arrange
## mpg cyl disp hp drat wt qsec vs am gear carb
## Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
## Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
## Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
## Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2
## Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1
## Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2
## Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2
## Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
## Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2
## Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1
## Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
## Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2
## Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
## Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
## Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6
## Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4
## Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2
## Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
## Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1
## Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4
## Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3
## Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3
## Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4
## Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2
## Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3
## AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2
## Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8
## Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4
## Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4
## Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4
## Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4
## Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4
desc function sorts data in descending order.
renaming a column using rename function:
# Rename the mpg column to miles_per_gallon
mtcars_rename <- rename(mtcars, miles_per_gallon = mpg)
mtcars_rename
## miles_per_gallon cyl disp hp drat wt qsec vs am gear
## Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4
## Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4
## Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4
## Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3
## Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3
## Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3
## Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3
## Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4
## Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4
## Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4
## Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4
## Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3
## Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3
## Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3
## Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3
## Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3
## Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3
## Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4
## Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4
## Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4
## Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3
## Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3
## AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3
## Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3
## Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3
## Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4
## Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5
## Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5
## Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5
## Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5
## Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5
## Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4
## carb
## Mazda RX4 4
## Mazda RX4 Wag 4
## Datsun 710 1
## Hornet 4 Drive 1
## Hornet Sportabout 2
## Valiant 1
## Duster 360 4
## Merc 240D 2
## Merc 230 2
## Merc 280 4
## Merc 280C 4
## Merc 450SE 3
## Merc 450SL 3
## Merc 450SLC 3
## Cadillac Fleetwood 4
## Lincoln Continental 4
## Chrysler Imperial 4
## Fiat 128 1
## Honda Civic 2
## Toyota Corolla 1
## Toyota Corona 1
## Dodge Challenger 2
## AMC Javelin 2
## Camaro Z28 4
## Pontiac Firebird 2
## Fiat X1-9 1
## Porsche 914-2 2
## Lotus Europa 2
## Ford Pantera L 4
## Ferrari Dino 6
## Maserati Bora 8
## Volvo 142E 2
add a column using mutate function:
# Add a new column for horsepower per weight
mtcars_mutate <- mutate(mtcars, hp_per_wt = hp / wt)
mtcars_mutate
## mpg cyl disp hp drat wt qsec vs am gear carb
## Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
## Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
## Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
## Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
## Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
## Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1
## Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4
## Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2
## Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2
## Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4
## Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4
## Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3
## Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3
## Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3
## Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4
## Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4
## Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4
## Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
## Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
## Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
## Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1
## Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2
## AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2
## Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4
## Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2
## Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1
## Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2
## Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2
## Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4
## Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6
## Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8
## Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2
## hp_per_wt
## Mazda RX4 41.98473
## Mazda RX4 Wag 38.26087
## Datsun 710 40.08621
## Hornet 4 Drive 34.21462
## Hornet Sportabout 50.87209
## Valiant 30.34682
## Duster 360 68.62745
## Merc 240D 19.43574
## Merc 230 30.15873
## Merc 280 35.75581
## Merc 280C 35.75581
## Merc 450SE 44.22604
## Merc 450SL 48.25737
## Merc 450SLC 47.61905
## Cadillac Fleetwood 39.04762
## Lincoln Continental 39.63864
## Chrysler Imperial 43.03087
## Fiat 128 30.00000
## Honda Civic 32.19814
## Toyota Corolla 35.42234
## Toyota Corona 39.35091
## Dodge Challenger 42.61364
## AMC Javelin 43.66812
## Camaro Z28 63.80208
## Pontiac Firebird 45.51365
## Fiat X1-9 34.10853
## Porsche 914-2 42.52336
## Lotus Europa 74.68605
## Ford Pantera L 83.28076
## Ferrari Dino 63.17690
## Maserati Bora 93.83754
## Volvo 142E 39.20863
# Combine two datasets with the same columns
mtcars_combined <- bind_rows(mtcars, mtcars)
mtcars_combined
## mpg cyl disp hp drat wt qsec vs am gear carb
## Mazda RX4...1 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
## Mazda RX4 Wag...2 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
## Datsun 710...3 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
## Hornet 4 Drive...4 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
## Hornet Sportabout...5 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
## Valiant...6 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1
## Duster 360...7 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4
## Merc 240D...8 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2
## Merc 230...9 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2
## Merc 280...10 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4
## Merc 280C...11 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4
## Merc 450SE...12 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3
## Merc 450SL...13 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3
## Merc 450SLC...14 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3
## Cadillac Fleetwood...15 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4
## Lincoln Continental...16 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4
## Chrysler Imperial...17 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4
## Fiat 128...18 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
## Honda Civic...19 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
## Toyota Corolla...20 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
## Toyota Corona...21 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1
## Dodge Challenger...22 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2
## AMC Javelin...23 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2
## Camaro Z28...24 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4
## Pontiac Firebird...25 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2
## Fiat X1-9...26 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1
## Porsche 914-2...27 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2
## Lotus Europa...28 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2
## Ford Pantera L...29 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4
## Ferrari Dino...30 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6
## Maserati Bora...31 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8
## Volvo 142E...32 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2
## Mazda RX4...33 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
## Mazda RX4 Wag...34 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
## Datsun 710...35 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1
## Hornet 4 Drive...36 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1
## Hornet Sportabout...37 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2
## Valiant...38 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1
## Duster 360...39 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4
## Merc 240D...40 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2
## Merc 230...41 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2
## Merc 280...42 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4
## Merc 280C...43 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4
## Merc 450SE...44 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3
## Merc 450SL...45 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3
## Merc 450SLC...46 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3
## Cadillac Fleetwood...47 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4
## Lincoln Continental...48 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4
## Chrysler Imperial...49 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4
## Fiat 128...50 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
## Honda Civic...51 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
## Toyota Corolla...52 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
## Toyota Corona...53 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1
## Dodge Challenger...54 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2
## AMC Javelin...55 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2
## Camaro Z28...56 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4
## Pontiac Firebird...57 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2
## Fiat X1-9...58 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1
## Porsche 914-2...59 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2
## Lotus Europa...60 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2
## Ford Pantera L...61 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4
## Ferrari Dino...62 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6
## Maserati Bora...63 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8
## Volvo 142E...64 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2
# Group the dataset by number of cylinders and summarize the mean mpg
mtcars_grouped <- group_by(mtcars, cyl)
mtcars_summarized <- summarize(mtcars_grouped, mean_mpg = mean(mpg))
mtcars_grouped
## # A tibble: 32 × 11
## # Groups: cyl [3]
## mpg cyl disp hp drat wt qsec vs am gear carb
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4
## 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4
## 3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1
## 4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1
## 5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2
## 6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1
## 7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4
## 8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2
## 9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2
## 10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4
## # ℹ 22 more rows
mtcars_summarized
## # A tibble: 3 × 2
## cyl mean_mpg
## <dbl> <dbl>
## 1 4 26.7
## 2 6 19.7
## 3 8 15.1
the above functions are called data manipulation functions. these functions are available in dplyr package.