R-script анализ датасета Жильцов Даниил

Материал из Поле цифровой дидактики

Описание датасета

Для анализа был взят датасет Astronauts, который содержит информацию о космонавтах и астронавтах, их миссиях, продолжительности полётов и выходах в открытый космос. В датасете содержатся следующие поля: "Profile.Astronaut Numbers.Overall", "Profile.Astronaut Numbers.Nationwide", "Profile.Name", "Profile.Gender", "Profile.Birth Year", "Profile.Nationality", "Profile.Military", "Profile.Selection.Group", "Profile.Selection.Year", "Profile.Lifetime Statistics.Mission count", "Mission.Role", "Mission.Year", "Mission.Name", "Mission.Vechicles.Ascent", "Mission.Vechicles.Orbit", "Mission.Vechicles.Decent", "Mission.Durations.Mission duration", "Profile.Lifetime Statistics.Mission duration", "Mission.Durations.EVA duration", "Profile.Lifetime Statistics.EVA duration" Источник датасета - страница Категория:Dataset. Ссылка на датасет на Corgis Corgis Dataset.

Код R-скрипта

library(tidyverse)

data <- read_csv("https://corgis-edu.github.io/corgis/datasets/csv/astronauts/astronauts.csv")

glimpse(data)

total_records <- nrow(data)
print(paste("Всего записей о миссиях:", total_records))

unique_astronauts <- data %>%
  distinct(`Profile.Name`) %>%
  nrow()
print(paste("Уникальных астронавтов в датасете:", unique_astronauts))

unique_names <- data %>%
  distinct(`Profile.Name`) %>%
  pull(`Profile.Name`)

words <- str_split(unique_names, " ") %>%
  unlist() %>%
  str_replace_all("[^A-Za-z]", "") %>%  
  .[. != ""]

total_words <- length(words)
print(paste("Всего слов в уникальных именах астронавтов:", total_words))

top10_words <- as.data.frame(sort(table(words), decreasing = TRUE)[1:10])
colnames(top10_words) <- c("Слово", "Частота")
rownames(top10_words) <- NULL

print("Самые часто встречающиеся имена (First name, middle name, last name):")
print(top10_words)

top_countries <- data %>%
  distinct(`Profile.Name`, `Profile.Nationality`) %>%
  count(Национальность = `Profile.Nationality`, sort = TRUE) %>%
  head(10)

print("Cтраны, отсортированные по числу астронавтов (по убыванию):")
print(top_countries)

Результаты анализа