This is my code
library(tidyverse)
# Criar um dataframe de exemplo com dados de futebol
dat <- tibble(
continent = rep(c("Asia", "Europe", "Africa", "Americas", "Oceania"), each = 5),
number_of_teams = sample(25:30, 25, replace = TRUE),
country = c("Japan", "South Korea", "China", "Iran", "Australia",
"Germany", "France", "Spain", "Italy", "England",
"Nigeria", "Egypt", "South Africa", "Ghana", "Cameroon",
"Brazil", "Argentina", "USA", "Mexico", "Colombia",
"New Zealand", "Fiji", "Solomon Islands", "Tahiti", "Papua New Guinea"),
games = sample(25:30, 25, replace = TRUE),
goals_team = sample(15:30, 25, replace = TRUE),
team_value = sample(1:10, 25, replace = TRUE)
)
# Aninhar (nest) os dados por continente
nested_data <- dat %>%
group_by(continent) %>%
nest() %>%
ungroup()
My problem is to name the column list
In other words when I do nested_data$data
I would like to see the continents name
Is it possible to ake this using the nest()
function?