It is a multiple question assignment which has been attached.
Intro to R Assignment 3 Question 1 (10 pts) 1. Load the datasets “pokemon_kanto”, “pokemon_johnto”, “pokemon_hoennplus” and bind them together 2. Clean the names of the dataset (note; you have to save the version with the clean names) #Problems 1 and 2 library(readxl) library(janitor) library(tidyverse) library(dplyr) Henn_df <- read.csv(file="Pokemon_HoennPlus.csv" ,="" header="TRUE," sep="," )="" colnames(henn_df)[1]="">-><- "#"="" colnames(henn_df)[7]="">-><- "sp.="" atk"="" colnames(henn_df)[8]="">-><- "sp.="" def"="" kanto_df="">-><- read_excel("pokemon_kanto.xlsx")="" johto_df="">-><- read_excel("pokemon_johto.xlsx")="" data_df="">-><- bind_rows(henn_df,kanto_df,johto_df)="" %="">% clean_names() head(data_df) 3. Filter out all those “Mega” Pokemon (they have a “Mega” in their name), but keep those “legendary” pokemon. data_df %>% filter(str_detect(name,"Mega") & legendary =="TRUE") 4. Load the dataset “pokemon_types” and merge it using their “id” number. Make sure that you are not duplicating columns. 7. -2pts: Use one of the join functions to avoid duplicating columns types_df <-read.csv(file= "pokemon_types.csv",="" header="TRUE," sep="," )="" %="">% clean_names () new_data <- new="" data="" %="">% left_join(types_df, by = c(“number”, “name”)) Question 2 (25 pt) At this stage, you can start an exploratory data analysis with this tidy dataset. Moving forward we will be using the cleaned dataset you created in question 1. 1. Create a table to summarize the number of pokemon in each generation. Which generation has the most amount of pokemon? (Tip: you can use n() to get the counts) (5 pt) 2. Create a table using summarize and group_by() and find which generation has the most amount of legendary pokemon? (5 pt) 3. How many different types of pokemon are there? (such as ground, water, etc.) 4. Using gtsummary() create a table to summarize the pokemon’s battle statistics (Total, Hp, Attack, Defense, Sp Attack, Sp Defense, Speed) by type. Make sure to include the mean and the standard deviation for each one. (5 pt) 5. Expand the table you created in 2.3 and include total counts for each pokemon type, an “overall” column that summaries of the statistics across all pokemon. (10 pt) Question 3 (30 pt) 1. Generate a ridge plot that shows the distribution of “Attack” across each of the different generations. Write a 3 sentence summary of what you see. Are there any differences in the distributions across generations? (10 pt) 2. Now let’s explore 2.3 and 2.4 graphically. Visualize the distribution of the “Total” battle statistic across the different pokemon types. While you could pick different kinds of plots, we want you to pick a plot that displays the median. From your plot, do you see any differences across the types? Write a 3 sentence summary of what you see. (10 pt) 3. Now explore the relationship between “Attack” and “Sp Attack”, can you plot these two variables together? Please include a smoother that indicates the trend between the two. Can you facet the plots based on wether or not the pokemon are legendary? (10 pt) #,Name,Total,HP,Attack,Defense,Sp. Atk,Sp. Def,Speed,Generation,Legendary 252,Treecko,310,40,45,35,65,55,70,3,FALSE 253,Grovyle,405,50,65,45,85,65,95,3,FALSE 254,Sceptile,530,70,85,65,105,85,120,3,FALSE 254,SceptileMega Sceptile,630,70,110,75,145,85,145,3,FALSE 255,Torchic,310,45,60,40,70,50,45,3,FALSE 256,Combusken,405,60,85,60,85,60,55,3,FALSE 257,Blaziken,530,80,120,70,110,70,80,3,FALSE 257,BlazikenMega Blaziken,630,80,160,80,130,80,100,3,FALSE 258,Mudkip,310,50,70,50,50,50,40,3,FALSE 259,Marshtomp,405,70,85,70,60,70,50,3,FALSE 260,Swampert,535,100,110,90,85,90,60,3,FALSE 260,SwampertMega Swampert,635,100,150,110,95,110,70,3,FALSE 261,Poochyena,220,35,55,35,30,30,35,3,FALSE 262,Mightyena,420,70,90,70,60,60,70,3,FALSE 263,Zigzagoon,240,38,30,41,30,41,60,3,FALSE 264,Linoone,420,78,70,61,50,61,100,3,FALSE 265,Wurmple,195,45,45,35,20,30,20,3,FALSE 266,Silcoon,205,50,35,55,25,25,15,3,FALSE 267,Beautifly,395,60,70,50,100,50,65,3,FALSE 268,Cascoon,205,50,35,55,25,25,15,3,FALSE 269,Dustox,385,60,50,70,50,90,65,3,FALSE 270,Lotad,220,40,30,30,40,50,30,3,FALSE 271,Lombre,340,60,50,50,60,70,50,3,FALSE 272,Ludicolo,480,80,70,70,90,100,70,3,FALSE 273,Seedot,220,40,40,50,30,30,30,3,FALSE 274,Nuzleaf,340,70,70,40,60,40,60,3,FALSE 275,Shiftry,480,90,100,60,90,60,80,3,FALSE 276,Taillow,270,40,55,30,30,30,85,3,FALSE 277,Swellow,430,60,85,60,50,50,125,3,FALSE 278,Wingull,270,40,30,30,55,30,85,3,FALSE 279,Pelipper,430,60,50,100,85,70,65,3,FALSE 280,Ralts,198,28,25,25,45,35,40,3,FALSE 281,Kirlia,278,38,35,35,65,55,50,3,FALSE 282,Gardevoir,518,68,65,65,125,115,80,3,FALSE 282,GardevoirMega Gardevoir,618,68,85,65,165,135,100,3,FALSE 283,Surskit,269,40,30,32,50,52,65,3,FALSE 284,Masquerain,414,70,60,62,80,82,60,3,FALSE 285,Shroomish,295,60,40,60,40,60,35,3,FALSE 286,Breloom,460,60,130,80,60,60,70,3,FALSE 287,Slakoth,280,60,60,60,35,35,30,3,FALSE 288,Vigoroth,440,80,80,80,55,55,90,3,FALSE 289,Slaking,670,150,160,100,95,65,100,3,FALSE 290,Nincada,266,31,45,90,30,30,40,3,FALSE 291,Ninjask,456,61,90,45,50,50,160,3,FALSE 292,Shedinja,236,1,90,45,30,30,40,3,FALSE 293,Whismur,240,64,51,23,51,23,28,3,FALSE 294,Loudred,360,84,71,43,71,43,48,3,FALSE 295,Exploud,490,104,91,63,91,73,68,3,FALSE 296,Makuhita,237,72,60,30,20,30,25,3,FALSE 297,Hariyama,474,144,120,60,40,60,50,3,FALSE 298,Azurill,190,50,20,40,20,40,20,3,FALSE 299,Nosepass,375,30,45,135,45,90,30,3,FALSE 300,Skitty,260,50,45,45,35,35,50,3,FALSE 301,Delcatty,380,70,65,65,55,55,70,3,FALSE 302,Sableye,380,50,75,75,65,65,50,3,FALSE 302,SableyeMega Sableye,480,50,85,125,85,115,20,3,FALSE 303,Mawile,380,50,85,85,55,55,50,3,FALSE 303,MawileMega Mawile,480,50,105,125,55,95,50,3,FALSE 304,Aron,330,50,70,100,40,40,30,3,FALSE 305,Lairon,430,60,90,140,50,50,40,3,FALSE 306,Aggron,530,70,110,180,60,60,50,3,FALSE 306,AggronMega Aggron,630,70,140,230,60,80,50,3,FALSE 307,Meditite,280,30,40,55,40,55,60,3,FALSE 308,Medicham,410,60,60,75,60,75,80,3,FALSE 308,MedichamMega Medicham,510,60,100,85,80,85,100,3,FALSE 309,Electrike,295,40,45,40,65,40,65,3,FALSE 310,Manectric,475,70,75,60,105,60,105,3,FALSE 310,ManectricMega Manectric,575,70,75,80,135,80,135,3,FALSE 311,Plusle,405,60,50,40,85,75,95,3,FALSE 312,Minun,405,60,40,50,75,85,95,3,FALSE 313,Volbeat,400,65,73,55,47,75,85,3,FALSE 314,Illumise,400,65,47,55,73,75,85,3,FALSE 315,Roselia,400,50,60,45,100,80,65,3,FALSE 316,Gulpin,302,70,43,53,43,53,40,3,FALSE 317,Swalot,467,100,73,83,73,83,55,3,FALSE 318,Carvanha,305,45,90,20,65,20,65,3,FALSE 319,Sharpedo,460,70,120,40,95,40,95,3,FALSE 319,SharpedoMega Sharpedo,560,70,140,70,110,65,105,3,FALSE 320,Wailmer,400,130,70,35,70,35,60,3,FALSE 321,Wailord,500,170,90,45,90,45,60,3,FALSE 322,Numel,305,60,60,40,65,45,35,3,FALSE 323,Camerupt,460,70,100,70,105,75,40,3,FALSE 323,CameruptMega Camerupt,560,70,120,100,145,105,20,3,FALSE 324,Torkoal,470,70,85,140,85,70,20,3,FALSE 325,Spoink,330,60,25,35,70,80,60,3,FALSE 326,Grumpig,470,80,45,65,90,110,80,3,FALSE 327,Spinda,360,60,60,60,60,60,60,3,FALSE 328,Trapinch,290,45,100,45,45,45,10,3,FALSE 329,Vibrava,340,50,70,50,50,50,70,3,FALSE 330,Flygon,520,80,100,80,80,80,100,3,FALSE 331,Cacnea,335,50,85,40,85,40,35,3,FALSE 332,Cacturne,475,70,115,60,115,60,55,3,FALSE 333,Swablu,310,45,40,60,40,75,50,3,FALSE 334,Altaria,490,75,70,90,70,105,80,3,FALSE 334,AltariaMega Altaria,590,75,110,110,110,105,80,3,FALSE 335,Zangoose,458,73,115,60,60,60,90,3,FALSE 336,Seviper,458,73,100,60,100,60,65,3,FALSE 337,Lunatone,440,70,55,65,95,85,70,3,FALSE 338,Solrock,440,70,95,85,55,65,70,3,FALSE 339,Barboach,288,50,48,43,46,41,60,3,FALSE 340,Whiscash,468,110,78,73,76,71,60,3,FALSE 341,Corphish,308,43,80,65,50,35,35,3,FALSE 342,Crawdaunt,468,63,120,85,90,55,55,3,FALSE 343,Baltoy,300,40,40,55,40,70,55,3,FALSE 344,Claydol,500,60,70,105,70,120,75,3,FALSE 345,Lileep,355,66,41,77,61,87,23,3,FALSE 346,Cradily,495,86,81,97,81,107,43,3,FALSE 347,Anorith,355,45,95,50,40,50,75,3,FALSE 348,Armaldo,495,75,125,100,70,80,45,3,FALSE 349,Feebas,200,20,15,20,10,55,80,3,FALSE 350,Milotic,540,95,60,79,100,125,81,3,FALSE 351,Castform,420,70,70,70,70,70,70,3,FALSE 352,Kecleon,440,60,90,70,60,120,40,3,FALSE 353,Shuppet,295,44,75,35,63,33,45,3,FALSE 354,Banette,455,64,115,65,83,63,65,3,FALSE 354,BanetteMega Banette,555,64,165,75,93,83,75,3,FALSE 355,Duskull,295,20,40,90,30,90,25,3,FALSE 356,Dusclops,455,40,70,130,60,130,25,3,FALSE 357,Tropius,460,99,68,83,72,87,51,3,FALSE 358,Chimecho,425,65,50,70,95,80,65,3,FALSE 359,Absol,465,65,130,60,75,60,75,3,FALSE 359,AbsolMega Absol,565,65,150,60,115,60,115,3,FALSE 360,Wynaut,260,95,23,48,23,48,23,3,FALSE 361,Snorunt,300,50,50,50,50,50,50,3,FALSE 362,Glalie,480,80,80,80,80,80,80,3,FALSE 362,GlalieMega Glalie,580,80,120,80,120,80,100,3,FALSE 363,Spheal,290,70,40,50,55,50,25,3,FALSE 364,Sealeo,410,90,60,70,75,70,45,3,FALSE 365,Walrein,530,110,80,90,95,90,65,3,FALSE 366,Clamperl,345,35,64,85,74,55,32,3,FALSE 367,Huntail,485,55,104,105->-read.csv(file=>->