Analyze & Visualize Country Data in R | tidyverse, dplyr & ggplot2 | Group, Summarize & Draw Bars

  Рет қаралды 967

Statistics Globe

Statistics Globe

7 ай бұрын

How to analyze and visualize a data set containing country information in the R programming language. More details: statisticsglobe.com/analyze-v...
The video analyzes group participants of the "Data Manipulation in R Using dplyr & the tidyverse" online course. More details here: statisticsglobe.com/online-co...
R code of this video:
x <- c("United Kingdom", # Create vector of countries "United Kingdom", "Australia", "United States", "United States", "United Kingdom", "Netherlands", "Austria", "United States", "United States", "Ireland", "United States", "United States", "United States", "Japan", "United States", "United States", "Bangladesh", "Congo", "Spain", "Spain", "Netherlands", "United States", "United States", "United States", "Chile", "United States", "Canada", "United States", "Spain", "United Kingdom", "Ireland", "United Kingdom", "Mexico", "Namibia", "United States", "India", "United States", "Romania", "Mexico", "Canada", "Tanzania", "Netherlands", "Portugal", "Germany", "United Kingdom", "United States", "United States", "Australia", "Sweden", "Japan", "Canada", "United States", "Italy", "France", "Germany", "Germany", "Sweden", "Mexico", "New Zealand", "Mexico", "South Korea", "United States", "United States", "United States", "South Africa", "United States", "United States", "Australia", "United States", "United States", "United States", "Iceland", "United States", "United States", "United Kingdom", "United Kingdom", "Ireland", "Germany", "United States", "United States", "Singapore", "United Kingdom", "United States", "Mexico", "United Kingdom", "Norway", "Brazil", "United States", "United States", "Canada", "Netherlands", "Canada", "Sweden", "United States", "United States", "United Kingdom", "Germany", "United States", "United States", "United States", "United States", "Trinidad and Tobago")install.packages("tidyverse") # Install tidyverse packagelibrary("tidyverse") # Load tidyversemy_tib_grouped <- tibble(country = x) %>% # Convert vector to tibble group_by(country) %>% # Group tibble summarize(country_count = n()) %>% # Calculate country count arrange(desc(country_count)) # Arrange tibble descendinglymy_tib_grouped # Print country datamy_ggp <- my_tib_grouped %>% # Create ggplot2 plot ggplot(aes(x = reorder(country, - country_count), y = country_count)) + geom_col() + # Specify to draw a barplot theme(axis.text.x = element_text(angle = 90, # Vertical x-axis labels hjust = 1, vjust = 0.3)) + xlab("Country") + # Change x-axis label ylab("Count") + # Change y-axis label ggtitle("dplyr Course Participants by Country") + # Change main title annotate("text", # Add text element to plot x = 15, y = 25, label = "Thank You !!", size = 15, color = "red")my_ggp # Draw ggplot2 plot
Follow me on Social Media:
Facebook - Statistics Globe Page: / statisticsglobecom
Facebook - R Programming Group for Discussions & Questions: / statisticsglobe
Facebook - Python Programming Group for Discussions & Questions: / statisticsglobepython
LinkedIn - Statistics Globe Page: / statisticsglobe
LinkedIn - R Programming Group for Discussions & Questions: / 12555223
LinkedIn - Python Programming Group for Discussions & Questions: / 12673534
Twitter: / joachimschork
Instagram: / statisticsglobecom
TikTok: / statisticsglobe

Пікірлер: 6
@aishiaratrika
@aishiaratrika 4 ай бұрын
Hi Joachim! I have been following your videos from the beginning and it's interesting how your channel has grown over time. I would like to request for in-depth videos on manipulating and analyzing publicly available secondary datasets such as DHS or MICS surveys, which would help a lot of researchers from developing nations.
@StatisticsGlobe
@StatisticsGlobe 4 ай бұрын
Hey, thank you so much for your constant support over the years, it's great that you are still following my channel! :) Also, thank you so much for your topic suggestion, I'll keep it in mind for the future content planning. Best regards, Joachim
@saimajahan1000
@saimajahan1000 7 ай бұрын
I have seen only participants from Bangladesh. That's me.😂. Once again great video. Interesting and informative.
@StatisticsGlobe
@StatisticsGlobe 7 ай бұрын
Haha, great Saima. I hope you enjoy the course so far! :)
@joaomatos2043
@joaomatos2043 7 ай бұрын
is a vector a kind of array in javascript?
@cansustatisticsglobe
@cansustatisticsglobe 7 ай бұрын
Hello! Yes, a vector in R can be conceptually similar to an array in JavaScript, although they belong to different programming environments and have some differences in behavior and properties. For instance, in R, a vector is a basic data structure that holds elements of the same type (numeric, character, logical, etc.). It's a one-dimensional array. In JavaScript, an array is a global object used to store a collection of elements. These elements can be of different types (numbers, strings, objects, etc.).See www.w3schools.com/r/r_vectors.asp for further details. Best, Cansu
Каха и суп
00:39
К-Media
Рет қаралды 5 МЛН
3M❤️ #thankyou #shorts
00:16
ウエスP -Mr Uekusa- Wes-P
Рет қаралды 15 МЛН
100❤️
00:19
MY💝No War🤝
Рет қаралды 21 МЛН
How I'd Learn Data Analytics in 2024 | 3 Month Plan
11:42
Rohan Adus
Рет қаралды 324 М.
Manipulate your data.   Data wrangling.   R programmning for beginners.
29:59
R Programming 101
Рет қаралды 73 М.
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1,1 МЛН