CommencerCommencer gratuitement

Visualizing Pokemon

Let's try visualizing the pokemon data. There are a lot of variables in the pokemon dataset, so let's only select a few that we really want to use as cognostics.

Cet exercice fait partie du cours

Visualizing Big Data with Trelliscope in R

Afficher le cours

Instructions

  • Reduce the variables in the dataset down to pokemon, type_1, attack, generation_id, and url_image using dplyr's select().
  • Re-specify the variable pokemon so that the Pokemon's names show up as a labels in the display by default by using the cog() function.
  • Specify a new variable, panel, that points trelliscope to the url_image variable for panel plotting.
  • Create the display using trelliscope() and name it "pokemon" and set it to have 3 rows and 6 columns by default.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

library(dplyr)
library(trelliscopejs)

# Create a new data frame to use for plotting
pokemon2 <- pokemon %>%
  # Reduce the variables in the dataset
  select(pokemon, type_1, attack, generation_id, url_image) %>%
  mutate(
    # Respecify pokemon
    pokemon = cog(val = ___, default_label = ___),
    # Create panel variable
    panel = img_panel(___)
  )

# Create the display
trelliscope(pokemon2, ___)
Modifier et exécuter le code