Welcome to The Carpentries Etherpad! This pad is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents. Use of this service is restricted to members of The Carpentries community; this is not for general purpose use (for that, try https://etherpad.wikimedia.org). Users are expected to follow our code of conduct: https://docs.carpentries.org/topic_folders/policies/code-of-conduct.html All content is publicly available under the Creative Commons Attribution License: https://creativecommons.org/licenses/by/4.0/ We will be recording this workshop via Zoom. Please see the Recording Notice: https://ucla-data-archive.github.io/2020-04-10-ucla/#recording-notice Recordings will be uploaded here: https://doi.org/10.25346/S6/ZJKUAC * Recordings from Week 1 & 2 are already there * Code from Week 1 & 2 is here: https://github.com/ucla-data-archive/2020-ucla-r ---------------------------------------------------------------------------- *Workshop Info Workshop website: https://ucla-data-archive.github.io/2020-04-10-ucla/ Zoom link: https://ucla.zoom.us/j/942467827 OR https://ucla.zoom.us/my/ucladatascience Lesson: http://swcarpentry.github.io/r-novice-gapminder/ In case you get knocked off Zoom or have issues logging in, email timdennis@ucla.edu *Setting up software & interfaces Needed Software * Latest stable version of R (3.6.3) https://cran.r-project.org/mirrors.html * Rstudio v1.2.5 - https://rstudio.com/products/rstudio/download/ * Direct link to R Markdown file we will use the first day (4/10) - Right Click to "Save Link As..." * https://raw.githubusercontent.com/ucla-data-archive/2020-ucla-r/master/basics-of-r.Rmd Zoom & Rstudio - Interface * Helpers will aid learners in how to get this interface < https://tinyurl.com/qnqm2l6> (so that instructor UI will mirror learners’ UI). During screen-sharing, (at top of screen) make sure: * “Fit-to-screen” is checked ☑️ * Side-by-side is UNchecked ? * Zoom - Nametags * Learners, please add your name to the Zoom Room so it reflects what you registered with. If you also prefer to use a pseudonym instead of your name, please let us know so we can match you with the registration. Zoom Course Norms * Stay on mute unless you need to talk. * Stay on video if you can, esp. during small group work. * Use the chat to ask a question and the helpers will respond. You can also direct message a helper. * We will be using the Zoom breakout rooms. You will be prompted to enter a breakout room. *------------------- Day 3 ------------------- Sign-In: Name / Affiliation / Email Leigh Phan / UCLA Library Data Science Center / leighphan@library.ucla.edu Kristian Allen (helper) he,him,his / UCLA Library / kallen2@library.ucla.edu Tim Dennis (helper) / UCLA Library / tdennis@library.ucla.edu Scott Gruber (helper) / UCLA Institute of the Environment and Sustainability / scott.gruber@ucla.edu Jamie Jamison (helper) / UCLA Library Data Science Center / jamison@library.ucla.edu Ibraheem Ali (helper) / UCLA Library / ibraheemali@library.ucla.edu Dave George (helper) / UCLA Anderson / dave.george@anderson.ucla.edu Geno Sanchez (helper) / he,him,his / UCLA Library / genosanchez@library.ucla.edu Keerthi Kocherlakota/ UCLA Anderson/ keerthi.k.2021@anderson.ucla.edu Holly Huang/ UCLA Dept of Medicine/ hollykthuang@ucla.edu Charlotte Fagan / UCLA Luskin, UCLA Anderson / charlotte.fagan.2021@anderson.ucla.edu Radon Liang/ UCLA Anderson/ radon.liang.2021@anderson.ucla.edu Cytlalli Gonzalez/UCLA Institute of Environment and Sustainability/ csglez99@gmail.com Doug Daniels / UCLA Library DSC / dougdaniels@library.ucla.edu Taylor Mobley, Fielding School of Public Health / tmmobley@ucla.edu Fan Zhao, Epidemiology, zhaofan1996@g.ucla.edu Phatharajit Phatharodom, UCLA Epidemiology, praephatjit@gmail.com Tony Lun, tony.lun.2021@anderson.ucla.edu Jennifer Lin, UCLA Epidemiology, ichunlinbebe@gmail.com Francisco Avalos Jr. / UCLA Stats / fraval@ucla.edu Sungwon Han, sungwon.han.2021@anderson.ucla.edu Joy Guey/UCLA Social Sciences Center for Education Research & Technology /joy@sscert.ucla.edu Ted Lee Soizic Riche/ UCLA Neurobiology/ soizic.riche@gmail.com Jayne Vidheecharoen / UCLA Luskin / jaynev@ucla.edu Anthony Linares/UCLA SOM/alinares@mednet.ucla.edu Terence Lam / UCLA ANderson / terence.lam.2021@anderson.ucla.edu Maryam Ghajar/Civil Eng/maryamghajar@ucla.edu Emily Martinez/emart615@g.ucla.edu Ankita Sharma / UCLA Anderson / ankita.sharma.2021@anderson.ucla.edu Leigh-Michil George (she, her, hers)/ Geffen Academy at UCLA / lgeorge@geffenacademy.ucla.edu Shawnt Issakhanian / UCLA Dept of Medicine / shawnti@g.ucla.edu Zhan Shu, UCLA Psychiatry, zhanshu@ucla.edu Sebastian Suarez, Master's of Social Sciences, ssuarez3@g.ucla.edu Lesson: https://swcarpentry.github.io/r-novice-gapminder/08-plot-ggplot2/index.html https://raw.githubusercontent.com/ucla-data-archive/2020-ucla-r/master/03_r-markdown_ggplot.Rmd * right-click and save > open in Rstudio (we'll use this in the 2nd phase of class) *Schedule: 9:15-9:40 - What is RMarkdown? How to setup an RMarkdown document 9:40-10:15 - Creating charts and graphics with ggplot2 + Exercises 10:15-10:25 - Break 10:30-11:00 - Exercises (Breakout rooms) 11:00-11:15 - Review & Discussion 11:15-11:45 - Exercises (Breakout rooms) 11:45-12:00 - Feedback survey + wrap up For access to recordings for previous sessions email any of the instructors or helpers denoted at the the top of the document. Examples of R Markdown # Headers # This is an `

` tag ### This is an `

` tag *#### My name is name-goes-here Link to R Markdown cheatsheet which has list of most common formatt https://github.com/rstudio/cheatsheets/raw/master/rmarkdown-2.0.pdf Adding a code chunk: mac cmd + alt + i in order to create some space between lines in the .Rmd file add
after the line of text. I usually add it twice to give some space between lines. library(gapminde # to look at ou Grammer of graphics visual representation of 'layers' that we are manipulating using these commands https://www.science-craft.com/wp-content/uploads/2014/06/ggplot-1.png ggplot(data=gapminder, mapping=aes(x=gdpPercap, y=lifeExp)) + geom_point() ggplot(data=gapminder, mapping=aes(x=gdpPercap, y=lifeExp, by=country, color=continent)) + geom_point() *Challenge Set 1. Modify the example so that the figure shows how life expectancy has changed over time. 2. In the previous examples and challenge we used the `aes` function to tell the scatterplot **geom** about the **x** and **y** locations of each point. Another _aesthetic_ property we can modify is the point _color_. Modify the code from the previous challenge to **color** the points by the "continent" column. What trends do you see in the data? Are they what you expected? *Common Breakout Room Questions * Is there a way to average the data and plot it? --> ```{r} ``` To get averages by continent and plot, we need to use group_by continent & year first, then summarize to add a mean: ```{r} gapminder %>% group_by(continent, year) %>% summarize(mean_gdpPercap = mean(gdpPercap)) %>% ggplot(aes(x=year, y = mean_gdpPercap, color=continent)) + geom_point() ``` *Challenge Set 2 1. Switch the order of the point and line layers from the previous example. What happened? *Challenge Set 1. Modify the color and size of the points on the point layer in the previous example. Hint: do not use the `aes` function. 2. Modify your solution to Challenge above so that the points are now a different shape and are colored by continent with new trendlines. Hint: The color argument can be used inside the aesthetic. *Take feedback survey: https://forms.gle/UUpvA3fmna4RGLyV Extra material for GGPLOT - if you want to continue: https://ucla-data-archive.github.io/2020-ucla-r/03b_ggplot-extras.html *DAY 4 - R Markdown Tim Dennis / UCLA Library Data Science Center / timdennis@ucla.edu Leigh Phan (she, her, hers) / UCLA Library Data Science Center / leighphan@library.ucla.edu Geno Sanchez (he, him, his,) / UCLA Digital Library / genosanchez@library.ucla.edu Kristian Allen (he, him, his) / UCLA Digital Library / kallen2@library.ucla.edu Ibraheem Ali (he, they) / UCLA Biomedical Library / ibraheemali@library.ucla.edu Phatharajit Phatharodom, UCLA Epidemiology, praephatjit@gmail.com Scott Gruber / UCLA Institute of the Environment and Sustainability / scott.gruber@ucla.edu Shawnt Issakhanian / UCLA Dept of Medicine / shawnti@g.ucla.edu Holly Huang/ UCLA Dept of Medicine/ hollykthuang@g.ucla.edu Taylor Mobley / UCLA Fielding School of Public Health / tmmobley@ucla.edu Jayne Vidheecharoen / UCLA Luskin / jaynev@ucla.edu Soizic Riche / UCLA Neurobiology/ soizic.riche@gmail.com Zhan Shu, UCLA Psychiatry, zhanshu@ucla.edu Tony Lun, UCLA Anderson, tony.lun.2021@anderson.ucla.edu Charlotte Fagan (she/her), UCLA Anderson/Luskin, charlotte.fagan.2021@anderson.ucla.edu Terence Lam, UCLA ANderson, terence.lam.2021@anderson.ucla.edu Joy Guey/UCLA Social Sciences Center for Education Research & Technology /joy@sscert.ucla.edu Fan Zhao/ Epidemiology/ fanzhao1996@g.ucla.edu Francisco Avalos Jr. / statistics / fraval@ucla.edu Download files for today: https://github.com/ucla-data-archive/2020-05-01-rmd/archive/master.zip * Download above zip file and unzip on your desktop * You can typically double click on the .Rproj file inside that directory and it will open the folder in Rstudio * if that doesn't work, from R Studio, you can `open project' and navigate to that folder and open the Rproj file *We will be working thru this lesson: http://swcarpentry.github.io/r-novice-gapminder/15-knitr-markdown/index.html Schedule: 9:10-9:30 - Why use R Markdown (slides) https://ucla-data-archive.github.io/2020-ucla-r/04a_r-markdown_slides.html 9:30-10:00 -Creating a R Markdown document, components of a R Markdown file, Markdown, code chunks 10:00 - 10:5 Exercises (Breakout room) 10:15-10:25 - Break 10:25-10:40 - How things get compiled, chunk options, & inline code 10:40-11:00 - Exercises (Breakout rooms) 11:00-11:15 - Composed example, sharing and rticles 11:15-11:45 - Exercises (Breakout rooms) 11:45-12:00 - Feedback survey + wrap up https://github.com/rstudio/cheatsheets/raw/master/rmarkdown-2.0.pdf One way to change image size in Rstudio: *![smiley!](smiley.jpg) *