Did you know that with R, you can clean and process your research data, conduct a wide range of statistical analyses, create publication-quality figures, and save scripts that allow you to reproduce your work with the push of a button – all using just one program!
Artwork by @allison_horst
R is a programming language that is popular in both academia and industry for its broad functionality and approachable learning curve. R and supporting tools are open-source and totally free, making it easy to find resources developed by a global community of users. No matter which discipline you work in, you’re likely to find packages and tutorials targeted toward the types of analyses you want to run, and resources that make it easy to get started or “unstuck”. You can also develop your own packages for specific purposes in your research and publish them for others to use.
Do you want to build your skills in the programming language R, write R code with others, or ask questions about working with R? Check out some examples of the many cool things you can build with R!
Fun with R
During R Café meetings, we’re trying out different tools and types of analysis. Here’s a small sample of what we’ve been working on:
Code
# Load library wordcloud2library(wordcloud2)#Load datawcloud_data <-readRDS(here('data', 'wcloud_data.RDS'))# Define colors tud_blue<-'#00A6D6'mycolors <-c( rep(tud_blue,6),rep('#000000',1000))# Create a word cloudset.seed(12345)wordcloud2(wcloud_data, size =0.7, color = mycolors)
Words used in IDE master theses: word cloud created with wordcloud2 package
Code
# Load networkD3 packagelibrary(networkD3)library(igraph)# Load data network <-readRDS(here('data', 'network.RDS'))# Create networkD3 object.network_D3 <-igraph_to_networkD3(g = network)# Define node size.network_D3$nodes$size <-100*V(network)$degree# Degine color group (I will explore this feature later).network_D3$nodes$group <-1# Define edges width. network_D3$links$value <-20*E(network)$width# Define coloursColourScale <-'d3.scaleOrdinal() .domain(["lions", "tigers"]) .range(["#00A6D6", "#694489"]);'# PlotforceNetwork(Links = network_D3$links, Nodes = network_D3$nodes, Source ='source', Target ='target',NodeID ='name',Group ='group', opacity =0.9,Value ='value',Nodesize ='size', # We input a JavaScript function.fontSize =7,zoom =TRUE, opacityNoHover =1,fontFamily ="sans-serif",linkColour ="black",colourScale =JS(ColourScale))
Connections between words in IDE master theses: bigram count network created with networkD3 package
Code
# Load library wordcloud2library(dygraphs)library(quantmod) # API to get stock data#Load data of TESLA stockTSLA <-getSymbols("TSLA", env=NULL)#Load data of AMZN stockAMZN <-getSymbols("AMZN", env=NULL)# create new df with Amazon and Tesla datastocks <-cbind(AMZN[,2:4], TSLA[,2:4])# Define colors tud_cols<-c('#00A6D6', '#EC6842', '#0C2340', '#FFB81C' )tud_cols2<-c('#00A6D6', '#00B8C8', '#0C2340', '#0076C2' )# Create a dygraphdygraph(stocks) %>%dySeries(c("AMZN.Low", "AMZN.Close","AMZN.High"), label ="AMZN") %>%dySeries(c("TSLA.Low", "TSLA.Close","TSLA.High"), label ="TSLA") %>%dyRangeSelector() %>%dyOptions(colors = tud_cols2[c(1,3)]) %>%dyAxis("x", drawGrid =FALSE)
Amazon and Tesla Share Prices with dygraphs package
Join the TU Delft R Café!
Live coding during our monthly R Café meeting in September 2022
R Café reproducible research & pizza meeting in February 2023
We’re a group of R enthusiasts from across the TU Delft community who meet monthly to discuss questions from the very broad Why should I use R? to the hyper-specific Why is my code not working?!
Together we make up a supportive community of practice for researchers to share knowledge and learn with each other in an open and informal setting.
If you plan to join online, please pre-register so that we can order enough refreshments. See below for upcoming dates and registration links, and make sure to update your registration if you can’t make it.
Our initiative was inspired by Utrecht University’s R Café now Programming Café.
Who can join?
The R Café is open to anyone who works in R or is interested in learning. No prior experience with R is necessary - all are welcome!
Artwork by @allison_horst
Many of our members have recently completed the Data Carpentry workshop and are looking for a space to continue practicing R skills with others. You can also join if you’ve got plenty of R experience and want to share some awesome tips and tricks (e.g., about an R package, type of analysis, or visualization) with others!
To get the most out of the R Café, we suggest that you bring your laptop with R and RStudio installed. You can find details on installing R and RStudio in the Resources section below - please let us know if you need any help.
How do R Café meetings run?
Our monthly meetings usually have a theme which we can touch upon by brief presentations by one or more of our members, exercises for us to work through, a group discussion, or some combination.
We take a hands-on approach to work through problems and always have RStudio open for live coding.
If you have an R-related question or challenge that is specific to your project, we are happy to discuss in any of our meetings. If your question requires a lot of context, it’s helpful if you can send us an email with details before the meeting.
Because we know our audience, we offer a unique combination of ☕ and 🍕.
Want to get involved?
Got a favorite topic you’d like us to explore, or an idea for a presentation at an upcoming R Café? Please let us know at: rcafe-lib@tudelft.nl
Do you have questions about working with R, or want to write R code with others?
Date: 7 July 2022
Time: 11:00AM – 12:00PM
Place: TU Delft Library, Gertrude Stein room
Do you have questions about working with R, or want to write R code with others?
Date: 9 June 2022
Time: 11AM - 12PM
Place: TU Delft BK Building, BG.West.350
Do you have questions about working with R, or want to write R code with others?
Date: 11 May 2022
Time: 10AM-11AM
Place: TU Delft Library, Steve Jobs room
Do you have questions about working with R, or want to write R code with others?
Date: 4 April 2022
Time: 11:30AM – 12:15PM
Place: Online
Do you have questions about working with R, or want to write R code with others?
Date: 3 March 2022
Time: 10:00AM – 10:45AM
Place: Online
Do you have questions about working with R, or want to write R code with others?
Date: 7 February 2022
Time: 11:00AM – 11:45AM
Place: Online
Do you have questions about working with R, or want to write R code with others?
Date: 29 November 2021
Time: 10AM-11AM
Place: Online
R Café Kickoff
Date: 1 November 2021
Time: 10AM-11AM
Place: TU Delft Library CoffeeStar
Source Code
---title: "TU Delft R Café"subtitle: "Community of practice"format: html: code-tools: true fig-cap-location: bottom toc: true toc-location: left toc-title: 'On this page'execute: warning: false message: false---```{r}#| label: setup#| echo: false#| include: false# Load libraries ----------------------------------------------------------# Package names# packages <- c("tidyverse", "here", "data.table", "igraph", "ggraph", "stringr", "tm", "tidytext", "pluralize" , "quanteda", "fst", "stopwords", "SnowballC", "textstem" , "viridis", "htmlwidgets", "webshot", "lexicon", "wesanderson", "RColorBrewer", "textdata", "stringi", "vembedr"# )# Install packages not yet installed# installed_packages <- packages %in% rownames(installed.packages())# if (any(installed_packages == FALSE)) {# install.packages(packages[!installed_packages], repos="http://cran.us.r-project.org")# }# Packages loading #invisible(lapply(packages, library, character.only = TRUE))# Themes and colors ----------------------------------------------------------library(here)library(ggplot2)# Set the ggplot themetheme_set(theme_minimal())bg <-'#f7f7f7'#'background' edge<-'gray60'label <-'gray40'tud_blue<-'#00A6D6'``` <!-- ```{r} --> <!-- #| label: logo --> <!-- #| echo: false --> <!-- htmltools::img(src = here("img", "TUDelft_logo_rgb.png"), --> <!-- alt = 'logo', --> <!-- width="12%", --> <!-- style = 'position:absolute; top:10px; right:0; padding:5px;') --> <!-- ``` -->![](img/poster_mailing_list.png)---# Why R?{#sec-whyr}Did you know that with R, you can clean and process your research data, conduct a wide range of statistical analyses, create publication-quality figures, and save scripts that allow you to reproduce your work with the push of a button – all using just one program! ::: {.column-margin}![Artwork by @allison_horst](img/r_first_then.png):::R is a programming language that is popular in both academia and industry for its broad functionality and approachable learning curve. R and supporting tools are open-source and totally free, making it easy to find resources developed by a global community of users. No matter which discipline you work in, you’re likely to find packages and tutorials targeted toward the types of analyses you want to run, and resources that make it easy to get started or “unstuck”. You can also develop your own packages for specific purposes in your research and publish them for others to use. Do you want to build your skills in the programming language R, write R code with others, or ask questions about working with R? Check out some examples of the many cool things you can build with R! ## Fun with RDuring R Café meetings, we're trying out different tools and types of analysis. Here's a small sample of what we've been working on:```{r}#| label: word-cloud#| fig-cap: "Words used in IDE master theses: word cloud created with `wordcloud2` package"#| code-fold: true# Load library wordcloud2library(wordcloud2)#Load datawcloud_data <-readRDS(here('data', 'wcloud_data.RDS'))# Define colors tud_blue<-'#00A6D6'mycolors <-c( rep(tud_blue,6),rep('#000000',1000))# Create a word cloudset.seed(12345)wordcloud2(wcloud_data, size =0.7, color = mycolors)``````{r}#| label: network#| fig-cap: "Connections between words in IDE master theses: bigram count network created with `networkD3` package"#| code-fold: true# Load networkD3 packagelibrary(networkD3)library(igraph)# Load data network <-readRDS(here('data', 'network.RDS'))# Create networkD3 object.network_D3 <-igraph_to_networkD3(g = network)# Define node size.network_D3$nodes$size <-100*V(network)$degree# Degine color group (I will explore this feature later).network_D3$nodes$group <-1# Define edges width. network_D3$links$value <-20*E(network)$width# Define coloursColourScale <-'d3.scaleOrdinal() .domain(["lions", "tigers"]) .range(["#00A6D6", "#694489"]);'# PlotforceNetwork(Links = network_D3$links, Nodes = network_D3$nodes, Source ='source', Target ='target',NodeID ='name',Group ='group', opacity =0.9,Value ='value',Nodesize ='size', # We input a JavaScript function.fontSize =7,zoom =TRUE, opacityNoHover =1,fontFamily ="sans-serif",linkColour ="black",colourScale =JS(ColourScale))``````{r}#| label: dygraphs#| fig-cap: "Amazon and Tesla Share Prices with `dygraphs` package"#| code-fold: true# Load library wordcloud2library(dygraphs)library(quantmod) # API to get stock data#Load data of TESLA stockTSLA <-getSymbols("TSLA", env=NULL)#Load data of AMZN stockAMZN <-getSymbols("AMZN", env=NULL)# create new df with Amazon and Tesla datastocks <-cbind(AMZN[,2:4], TSLA[,2:4])# Define colors tud_cols<-c('#00A6D6', '#EC6842', '#0C2340', '#FFB81C' )tud_cols2<-c('#00A6D6', '#00B8C8', '#0C2340', '#0076C2' )# Create a dygraphdygraph(stocks) %>%dySeries(c("AMZN.Low", "AMZN.Close","AMZN.High"), label ="AMZN") %>%dySeries(c("TSLA.Low", "TSLA.Close","TSLA.High"), label ="TSLA") %>%dyRangeSelector() %>%dyOptions(colors = tud_cols2[c(1,3)]) %>%dyAxis("x", drawGrid =FALSE) ```# Join the TU Delft R Café!{#sec-joinrcafe}![Live coding during our monthly R Café meeting in September 2022](img/r_cafe.jpg)![R Café reproducible research & pizza meeting in February 2023](img/r_cafe_feb.jpg)We’re a group of R enthusiasts from across the TU Delft community who meet monthly to discuss questions from the very broad *Why should I use R?* to the hyper-specific *Why is my code not working?!*Together we make up a supportive community of practice for researchers to share knowledge and learn with each other in an open and informal setting.If you plan to join online, please pre-register so that we can order enough refreshments. See below for upcoming dates and registration links, and make sure to update your registration if you can’t make it.Our initiative was inspired by Utrecht University’s R Café now [Programming Café](https://www.uu.nl/en/research/research-data-management/walk-in-hours-workshops/programming-cafe).# Who can join?{#sec-who}The R Café is open to anyone who works in R or is interested in learning. No prior experience with R is necessary - all are welcome! ::: {.column-margin}![Artwork by @allison_horst](img/monsteRs.jpg):::Many of our members have recently completed the Data Carpentry workshop and are looking for a space to continue practicing R skills with others. You can also join if you’ve got plenty of R experience and want to share some awesome tips and tricks (e.g., about an R package, type of analysis, or visualization) with others! To get the most out of the R Café, we suggest that you bring your laptop with R and RStudio installed. You can find details on installing R and RStudio in the [Resources](#sec-res) section below - please let us know if you need any help.# How do R Café meetings run?{#sec-how}Our monthly meetings usually have a theme which we can touch upon by brief presentations by one or more of our members, exercises for us to work through, a group discussion, or some combination.We take a hands-on approach to work through problems and always have RStudio open for live coding. ::: {.column-margin}![](img/pizza2.gif):::If you have an R-related question or challenge that is specific to your project, we are happy to discuss in any of our meetings. If your question requires a lot of context, it’s helpful if you can send us an email with details before the meeting. Because we know our audience, we offer a *unique* combination of `r emo::ji("coffee")` and `r emo::ji("pizza")`.:::{.callout-tip}## Want to get involved?Got a favorite topic you’d like us to explore, or an idea for a presentation at an upcoming R Café? Please let us know at: [rcafe-lib@tudelft.nl](mailto:rcafe-lib@tudelft.nl):::# Resources {#sec-res}Some inspiration for working with R! - [Install R for your OS](https://cran.r-project.org/)- [Install RStudio](https://www.rstudio.com/products/rstudio/download/#download)- [Gallery of data visualization in R](https://r-graph-gallery.com/)- [Reproducible Research in R](https://datacarpentry.org/rr-workshop/)- [R for Excel](https://rstudio-conf-2020.github.io/r-for-excel/)- [Learning statistics with R](https://bookdown.org/ekothe/navarro26/preface.html)- [Text mining with R](https://juliasilge.shinyapps.io/learntidytext/)- [Happy Git and GitHub for the useR](https://happygitwithr.com/)::: {.column-margin}![Artwork by @allison_horst](img/monster_support.jpg):::For a full list of R resources collected by members of the R Café, click [here](https://delft-rcafe.github.io/resources/).# Contact {#sec-contact}The R Café initiative emerged in the TU Delft Library [Research Data Services](https://www.tudelft.nl/library/research-data-management) Team and the [Digital Competence Centre](https://www.tudelft.nl/library/library-voor-onderzoekers/library-voor-onderzoekers/onderzoek-starten/dcc).::: {.column-margin}![Artwork by @allison_horst](img/rtwitter.png):::The organizers are [Aleksandra Wilczynska]( https://www.tudelft.nl/library/research-data-management/r/support/data-stewardship/contact/aleksandra-wilczynska), [Bjørn Bartholdy](https://www.tudelft.nl/library/research-data-management/r/support/data-stewardship/contact/bjoern-bartholdy) and [Roel Janssen](https://community.data.4tu.nl/members/rrejanssen/). For questions or more information, please contact [rcafe-lib@tudelft.nl](mailto:rcafe-lib@tudelft.nl). You can also find us on [GitHub](https://github.com/Delft-RCafe). ## Subscribe {#sec-subscribe}To stay informed about upcoming events, please subscribe to our [mailing list](https://c.spotler.com/ct/m7/k1/N8Z4e19vGcZGN2mE3VcMXfDMXZoWzWbiRLJZ2JUjp5kjHNFzI5QbCaHn2bZuk-sa/bWDAUgBpGub4uVH).# Upcoming meetings {#sec-upcoming}TBD# Past meetings {#sec-past}##### R Café May 2024: **Using APIs to retrieve social media data**- Date: Thursday, 23rd May 2024- Time: 12PM – 13:30PM CEST- Place: TU Delft Library, **Blue** Room- Presenter: Sofia Gil-Clavel- Resources: [GitHub repo](https://github.com/SofiaG1l/Taller_COLMEX_API/tree/main/Facebook_API)##### R Café April 2024: **R vs Python**- Date: Thursday, 25th April 2024- Time: 12PM – 13:30PM CEST- Place: TU Delft Library, **Blue** Room- Presenter: Roel Janssen##### R Café March 2024: **Open forum - come and have a chat!**- Date: Friday, 22nd March 2024- Time: 12PM – 13:30PM CEST- Place: TU Delft Library, Albert Einstein- Presenter: NA##### R Café February 2024: **Creating an R Package (the sequel)**- Date: Friday, 23rd February 2024- Time: 12PM – 13:30PM CEST- Place: TU Delft Library, Orange Room- Presenter: TBD- Resources: [presentation](https://raw.githack.com/Delft-RCafe/resources/main/themes/creating-r-package/index.html); [repo](https://github.com/Delft-RCafe/resources/tree/main/themes/creating-r-package)##### R Café January 2024: **Creating an R package**- Date: Thursday, 11th January 2024- Time: 12PM – 13:30PM CEST- Place: TU Delft Library, Orange Room- Presenter: [Bjørn Bartholdy](https://www.universiteitleiden.nl/en/staffmembers/bjorn-peare-bartholdy#tab-1)- Resources: [presentation](https://raw.githack.com/Delft-RCafe/resources/main/themes/creating-r-package/index.html); [repo](https://github.com/Delft-RCafe/resources/tree/main/themes/creating-r-package)##### R Café December 2023: **Advent of Code**- Date: Friday, 15th December 2023- Time: 12PM – 13:30PM CEST- Place: TU Delft Library, Orange Room- Presenter: [Bjørn Bartholdy](https://www.universiteitleiden.nl/en/staffmembers/bjorn-peare-bartholdy#tab-1)##### Code performance in R- Date: Friday, 17th November 2023- Time: 12PM – 13:30PM CEST- Place: TU Delft Library, Orange Room- Presenter: [Roel Janssen](https://community.data.4tu.nl/members/rrejanssen/)##### Plot-a-thon showcase event- Date: 11th October 2023- Time: 15PM – 17PM CEST- Place: TU Delft Library, Orange Room- Presenter: [Roel Janssen](https://community.data.4tu.nl/members/rrejanssen/)##### Use APIs to source your data in R- Date: 29th September 2023- Time: 12PM – 13:30PM CEST- Place: TU Delft Library, Orange Room- Presenter: [Bjørn Bartholdy](https://www.universiteitleiden.nl/en/staffmembers/bjorn-peare-bartholdy#tab-1) & [Aleksandra Wilczynska](https://www.tudelft.nl/library/research-data-management/r/support/data-stewardship/contact/aleksandra-wilczynska)- **Resources: [Walkthrough](https://raw.githack.com/Delft-RCafe/resources/main/themes/apis_in_r/apis-in-r.html)**##### Troubleshooting walk-in session- Date: 7 July 2022- Time: 3:00PM – 4:30PM CEST- Place: TU Delft BK Building, BG.West.350##### A gentle introduction to building web apps with R Shiny- Date: 30th May 2023- Time: 12PM – 13:30PM CEST- Place: TU Delft Library, Blue Room- Presenter: [Aleksandra Wilczynska](https://www.tudelft.nl/library/research-data-management/r/support/data-stewardship/contact/aleksandra-wilczynska) & [Ashley Cryan](https://www.tudelft.nl/library/research-data-management/r/support/data-stewardship/contact/ashley-cryan)- **Resources: [R project](https://github.com/Delft-RCafe/resources/tree/main/themes/intro_shiny)**##### Level up your reproducibility game with Quarto- Date: 24th April 2023- Time: 12PM – 13:30PM CEST- Place: TU Delft Library, Orange Room- Presenters: [Claudiu Forgaci](https://www.tudelft.nl/en/staff/c.forgaci/?cHash=9502327a507dad434f22a30ca4f4771b) & [Bjørn Bartholdy](https://www.universiteitleiden.nl/en/staffmembers/bjorn-peare-bartholdy#tab-1)- **Resources: [R project](https://github.com/bbartholdy/quarto-level-up-reproducibility/releases/tag/v23.04.0-beta)**##### Network science approach to psychopathology using R- Date: 17th March 2023 - Time: 12PM – 13:30PM CEST - Place: TU Delft Library, Orange Room- Presenter: [Alberto Jover Martínez](https://www.nsmd.eu/organisation/people/jover-martinez-alberto)- **Resources: [R project](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/Delft-RCafe/resources/tree/main/themes/network_science)** ##### Organizing a research paper as an R package- Date: 10th February 2023 - Time: 11AM – 12:30PM CEST - Place: TU Delft Library, ~~Albert Einstein room~~ ~~Blue Room~~ **Orange Room**- Presenter: [Bjørn Bartholdy](https://www.universiteitleiden.nl/en/staffmembers/bjorn-peare-bartholdy#tab-1)- **Resources: [Walk-through](https://github.com/Delft-RCafe/resources/tree/main/themes/research_package) **##### Dealing with messy data in R- Date: 13th January 2023 - Time: 11AM – 12:30PM CEST - Place: TU Delft BK Building, BG.West.640- Presenter: Rodrigo Revilla- **Resources: [Workbook](https://github.com/Delft-RCafe/resources/tree/main/themes/pdf_to_R) **##### R for Geospatial Data- Date: 2nd December 2022 - Time: 11AM – 12:30PM CEST - Place: TU Delft Library, Albert Einstein room - **Resources: [Exercises](https://github.com/Delft-RCafe/resources/tree/main/themes/geospatial)** ##### Time series visualisation with `dygraphs` library- Date: 4th November 2022 - Time: 11AM – 12:30PM CEST - Place: TU Delft BK Building, BG.West.670- **Resources: [Exercises](https://github.com/Delft-RCafe/resources/tree/main/themes/xts_dygraphs)** ##### Using the `apply` family of functions- Date: 26 September 2022- Time: 11AM – 12:30PM CEST- Place: TU Delft Library, Steve Jobs room - **Resources: [Exercises](https://github.com/Delft-RCafe/resources/tree/main/themes/apply_family)** ##### Prepare your script without data- Date: 26 August 2022- Time: 11AM – 12:30PM- Place: TU Delft Library, Steve Jobs room- **Resources: [Slides](https://delft-rcafe.github.io/2022-08-26-Prepare-your-script/Index.html#/)** ##### Do you have questions about working with R, or want to write R code with others?- Date: 7 July 2022- Time: 11:00AM – 12:00PM- Place: TU Delft Library, Gertrude Stein room ##### Do you have questions about working with R, or want to write R code with others?- Date: 9 June 2022 - Time: 11AM - 12PM- Place: TU Delft BK Building, BG.West.350 ##### Do you have questions about working with R, or want to write R code with others?- Date: 11 May 2022- Time: 10AM-11AM- Place: TU Delft Library, Steve Jobs room ##### Do you have questions about working with R, or want to write R code with others?- Date: 4 April 2022- Time: 11:30AM – 12:15PM- Place: Online ##### Do you have questions about working with R, or want to write R code with others?- Date: 3 March 2022- Time: 10:00AM – 10:45AM- Place: Online ##### Do you have questions about working with R, or want to write R code with others?- Date: 7 February 2022- Time: 11:00AM – 11:45AM- Place: Online ##### Do you have questions about working with R, or want to write R code with others?- Date: 29 November 2021- Time: 10AM-11AM- Place: Online ##### R Café Kickoff- Date: 1 November 2021- Time: 10AM-11AM- Place: TU Delft Library CoffeeStar