Data solutions with R

Data solutions with R

Share

01/13/2024

Taking part in Veganuary? Plant-based meat alternatives have increased in popularity over the past decade; the latest edition of in C&EN looks at what they're made from and how chemistry helps improve their appearance and flavour: https://cen.acs.org/food/food-science/Periodic-Graphics-chemistry-meat-alternatives/102/i1

01/03/2024
01/01/2024

Here is today's killer bar chart using ggplot.
Happy new years friends!

Here is the code to reproduce the plot:
library(ggplot2)diamonds %>% count(cut) %>% ggplot(aes(x = reorder(cut, -(-n)), y = n, fill = cut)) + geom_col() + geom_text(aes(label = scales::percent(n / sum(n), scale_factor = 1), hjust=-.4), position = position_stack(vjust = 0.5), size = 7) + theme(legend.position = "none", axis.text.y = element_text(size = 17), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(color = "white"), axis.ticks.y = element_blank(), axis.ticks.x = element_blank(), axis.text.x = element_blank()) + coord_flip() + labs(x='', y='', title = paste(names(diamonds["cut"]))) + expand_limits(y = 0)

12/24/2023

many students find it hard to find the highest values for a given column. Here are 2 cool ways to do it in R:

Method 1:
iris %>% top_n(2, wt = Sepal.Width)

Method 2:
iris %>% arrange(desc(Sepal.Length)) %>% head(2)

RStudio - YouTube 02/24/2022

Data scientists are changing the world

RStudio - YouTube RStudio’s mission is to create free and open-source software for data science, scientific research, and technical communication to enhance the production and...

Want your school to be the top-listed School/college in Ottawa?
Click here to claim your Sponsored Listing.

Address


451 Smyth Road
Ottawa, ON
K1H8M5