- 77
- 52 783
Emmanuel Teitelbaum
United States
เข้าร่วมเมื่อ 14 ต.ค. 2011
I am an associate professor of political science and international affairs at The George Washington University in Washington, DC. I hope you find some of my videos helpful!
Tips for Developing Your First Shiny App
In this video, I provide my students with some tips for developing their apps for their final projects and how to troubleshoot when the app is not doing what you want it to do.
Table of Contents:
00:33 - 1. Work on the data first
01:24 - 2. Make use of separate files
02:31 - 3.Start with comments and function calls
04:55 - 4. Test your UI code by itself
05:58 - 5. Make sure you call input$ when needed
06:47 - 6. Nonstandard evaluation with ggplot
07:31 - 7. Use parentheses with reactive data
08:42 - 8. Print reactive data
11:17 - 9. Think about what your code is doing
Table of Contents:
00:33 - 1. Work on the data first
01:24 - 2. Make use of separate files
02:31 - 3.Start with comments and function calls
04:55 - 4. Test your UI code by itself
05:58 - 5. Make sure you call input$ when needed
06:47 - 6. Nonstandard evaluation with ggplot
07:31 - 7. Use parentheses with reactive data
08:42 - 8. Print reactive data
11:17 - 9. Think about what your code is doing
มุมมอง: 65
วีดีโอ
How to Share Your Shiny App
มุมมอง 4277 หลายเดือนก่อน
In this video, I show my students how to publish their apps on ShinyApps.io and how to share their code via email or GitHub. Table of Contents: 02:13 - Publishing your app to ShinyApps.io 06:34 - Sharing code via email or GitHub 12:47 - Record your environment with renv
Build a Shiny App with Two Reactive Elements (Part 3)
มุมมอง 497 หลายเดือนก่อน
In this series, I show my students how to build a Shiny App with two reactive elements (a dropdown and a slider). In this video, we work on building the server function. Table of Contents: 00:50 - Start the server function 01:15 - Reactive function to query FRED API 04:09 - Reactive function to filter dates 08:33 - Write ggplot code for line chart 14:36 - Run the app
Build a Shiny App with Two Reactive Elements (Part 2)
มุมมอง 187 หลายเดือนก่อน
In this series, I show my students how to build a Shiny App with two reactive elements (a dropdown and a slider). In this video, we work on building the user interface (UI). Table of Contents: 00:57 - Start ui with fluidPage() 01:15 - Add title panel 01:30 - Create the dropdown menu 03:56 - Add help text 06:16 - Build the main panel and slider
Build a Shiny App with Two Reactive Elements (Part 1)
มุมมอง 697 หลายเดือนก่อน
In this series, I show my students how to build a Shiny App with two reactive elements (a dropdown and a slider). In this video, we cover the basics of what the app is going to do and the setup section of the code for the app. Table of Contents: 00:54 - App overview 03:45 - Set up the Shiny project 04:31 - Helper script for recession shading 05:46 - Load packages 06:16 - Set API key 07:12 - Sto...
Build a Scatter Plot App with V-Dem Data, Part 3
มุมมอง 978 หลายเดือนก่อน
In this video, I show my students how to build the server function a Shiny App where users can select which variables they want to see on the x- and y-axes of a scatter plot. Table of Contents: 01:25 - Start the server function 02:18 - Define the scatter plot output 07:22 - Dynamically updating axis labels 11:29 - Run the app
Build a Scatter Plot App with V-Dem Data, Part 2
มุมมอง 498 หลายเดือนก่อน
In this video, I show students how to build the user interface (UI) for a scatter plot where users can select which variables from the Varities of Democracy (V-Dem) dataset that they want to see on the x- and y-axes). Table of Contents: 00:44 - Overview of the app 02:00 - Defining the UI
Build a Scatter Plot App with V-Dem Data, Part I
มุมมอง 1158 หลายเดือนก่อน
In this video, I show students how to get started with building an R Shiny app that displays two variables from the Varieties of Democracy (V-Dem) dataset in a scatter plot. We wrangle some data from the V-Dem dataset, store it in a CSV file and then write the setup code chunk for the app. Table of Contents: 02:06 - Start a Shiny project 03:50 - Wrangling the data 11:44 - Setup code chunk for t...
Download Data from the World Bank API
มุมมอง 60710 หลายเดือนก่อน
In this video, I show students how to download data from the World Bank API in R using the wbstats package. Along the way we also learn some new dplyr and janitor functions. Table of Contents: 02:40 - Set up code chunk, load packages 03:30 - Find indicator codes 08:28 - Store list of indicators 10:04 - Download data from WB API 13:32 - Viewing the data
Transforming Data with dplyr Verbs
มุมมอง 27910 หลายเดือนก่อน
In this video I show students how to tranform data using filter(), select() and mutate() from the dplyr package in R. This video is part of a series of videos on wrangling data in R: th-cam.com/play/PLz_H8pWWERSx2Tp_zDW0PB4c63x1Zl_Mu.html&si=ZyHZvKtqiJJCZRJK Code and data are here: github.com/eteitelbaum/youtube-code Table of Contents: 01:27 - Quick tour of V-Dem website 02:59 - Setup 04:22 - D...
Grouping and Summarizing Data with dplyr Verbs
มุมมอง 11810 หลายเดือนก่อน
In this video, I use Varieties of Democracy (V-Dem) data to show students how to group, summarize and arrange data using dplyr verbs. This video is part of a series of videos on wrangling data in R: th-cam.com/play/PLz_H8pWWERSx2Tp_zDW0PB4c63x1Zl_Mu.html&si=ZyHZvKtqiJJCZRJK Code and data are here: github.com/eteitelbaum/youtube-code Table of Contents: 01:07 - Prep the Quarto document 02:14 - Wr...
Cleaning Data in R
มุมมอง 40010 หลายเดือนก่อน
In this video, I show students how to clean data with functions from the dplyr and janitor packages. We take some messy variable names, truncate them and put them into snake case. And we take some variables that are in character format and change them to numeric. This video is part of a series of videos on wrangling data in R: th-cam.com/play/PLz_H8pWWERSx2Tp_zDW0PB4c63x1Zl_Mu.html&si=ZyHZvKtqi...
Reshaping Data in R
มุมมอง 15810 หลายเดือนก่อน
In this video I show students how to reshape data using the privot_longer() function from the tidyr package. This video is part of a series of videos on wrangling data in R: th-cam.com/play/PLz_H8pWWERSx2Tp_zDW0PB4c63x1Zl_Mu.html&si=ZyHZvKtqiJJCZRJK Code and data are here: github.com/eteitelbaum/youtube-code Table of Contents: 01:17 - Prep work 02:00 - Add code chunk for reshaping data 03:19 - ...
Reading Data into R
มุมมอง 13410 หลายเดือนก่อน
In this video, I show students how to read data into R. First we download some World Bank data as a CSV file and then use the read_csv() function to pull it into R. This video is part of a series of videos on wrangling data in R: th-cam.com/play/PLz_H8pWWERSx2Tp_zDW0PB4c63x1Zl_Mu.html&si=ZyHZvKtqiJJCZRJK Code and data are here: github.com/eteitelbaum/youtube-code Table of Contents: 00:27 - Down...
Make a Scatter Plot with ggplot2
มุมมอง 17010 หลายเดือนก่อน
In this video, I show my students how to make a scatter plot in R with ggplot2. I go over how to make a basic scatter plot using Varieties of Democracy data. Then I show how to add dimensions with color and size, how to add a trend (regression) line, how to facet wrap and finally how to label points. Data: github.com/eteitelbaum/course-datasets/blob/main/dem_women.csv Table of Contents: 00:06 -...
Cleaning Variable Names with the Janitor Package
มุมมอง 188ปีที่แล้ว
Cleaning Variable Names with the Janitor Package
Truncating Strings and Changing Variable Types
มุมมอง 98ปีที่แล้ว
Truncating Strings and Changing Variable Types
Tips for Developing Your First Shiny App
มุมมอง 101ปีที่แล้ว
Tips for Developing Your First Shiny App
Build a Shiny App with Two Reactive Elements (Part 3)
มุมมอง 88ปีที่แล้ว
Build a Shiny App with Two Reactive Elements (Part 3)
Build a Shiny App with Two Reactive Elements (Part 2)
มุมมอง 98ปีที่แล้ว
Build a Shiny App with Two Reactive Elements (Part 2)
Huge help! Thanks
thanksssssssss!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11
Great work keep it up Professor
Thanks!
Nice tutorial on building a shiny app. Do you recommend any of the online coding schools to your students? Like Datacamp or others? Just curious. I am just seeking a recommendation, if you have any. Thanks.
Thanks! I have used both datacamp and dataquest.io. I lean more toward datacamp these days because I like a mix of videos and coding exercises but both are great! I also like Udemy courses. I kind of have an itch to do my own Udemy course, actually.
Hi Emmanuel, you actually do have the tools to put together a great course in R & Shiny from beginner to advanced level. I can't wait to see your course for Data analytics in R & Shiny where one can have the skills to mine, manipulate, MAP, and summarize for building interactive visualized dashboards from flat files and API's. courses that are based on real projects are unbeatable in online learning platforms like Udemy... Good luck and to move ahead..
@@zakmnmoh Hi! Thanks for the vote of confidence. I was actually about starting work on a Udemy course this summer!
@@emmanuelteitelbaum Hi prof, I'm curious to know if you have done your course for Data analytics in R & Shiny?
This series are wonderful and very helpful, You are a good teacher ,Tanks
You're welcome!
This was such a helpful tutorial!! Thank you so much for taking the time to create it.
Glad you liked it!
Hi Prof. Emmnuel, This is wonderful conclusion with great interactivity between data and visual outputs.. If you can share the whole project video, it will be highly appreciated for teaching purposes. The knowledge of connecting the dots for beginners in R and Shiny starts here..Thank you.
Hi! the link to the app and the code is in the description there...
I found this error after going through the code you provided. Error: API call executed successfully, but did not return expected json format
Thanks. I have been experiencing that too. It means the World Bank API is down.
Heyy Emmanuel, I'm having a problem, i hope you can solve this The problem is i need to export data from Firebase Realtime Database to Power BI Online where the Database is adds the data every minute, i need analytics updated for every minute If you have a solution please help me out
I don't have any experience with Firebase or Power BI. Sorry!
*Promo SM*
Very nice. I think Quarto is a giant leap ... (it reminds of LaTeX with executable code - the yaml looks like the preamble in LaTeX). I am doing all my code and writing in quarto now.
Thank you. I've noticed that if you just change a little bit a code to region =factor(case_match...) it will automatically make a region variable be factored.
Thanks! I'll try that out...
very helpful i enjoyed very well! thanks!!! 😝
One thought that crossed my mind when looking at the participation of women in the workforce and parliament in Iceland is how complete the data is from the World Bank. As a native of Iceland I would be shocked if these records would not extend much further back in time (even after removing the time limits with the mrv argument). It makes me think that these data warehouses that use secondary data might be lacking. On the positive side they (warehouses) allow us to get a quick look at the data and see if there is anything worth pursuing further.
Nice nice indeed. I took a slightly different approach and download percentage values for the female work participation to be consistent with the parliament participant. I also used forestmangr::round_df(digits = 2) to round the numeric data in one step at the end. Your approach is better since students get a deeper understanding of what is going on under the hood.
It is hard to fix these strings when they are different and regex is not exactly something that one learns overnight. I did, however, find a package called "nc" (named capture) that is quite interesting. It appears to be written for medical folks who often deal with complex strings (e.g., genes etc). It is worth the look but it is not simple stuff.
I like the way you handle the extraneous stuff in the year variable. This sort of thing is a common occurrence in messy data. I would probably go with stringr and use str_sub() just to stay consistent with the tidy approach. In these situations I have typically gone with str_detect or str_match but the sub approach looks simpler. Not sure whether the base r or the tidy approach is the better way to go - probably neither. Base r will always work but it might be simpler to teach the tidyverse since it is more intuitive. What is your experience with students? Base r or tidyverse? Does it even matter?
Very ineresting. I worked on some CO2 emission data from WB and it was much worse! I had column names showing up in rows as values . I also wound up with a third column containing everything else - a column name, values and years all stuffed into to the third column.
Yeah, it is very messy if you just try and download the data as a CSV. Check out this follow-up video where I show how to download data from the World Bank API using the wbstats package. Much better! th-cam.com/video/Z_jEYnRBv4M/w-d-xo.html
I did that earlier but did not want to bring it up because it might spoil the lesson for the students. I have already used the wbstats and WDI APIs to get cleaner data.
btw: The solution for getting a proper download was to skip the first three lines in the read_csv() but it was still quite messy.
Hello and thank you for the great help! It worked perfectly for me, but i got one issue. I used in addition to modelsummary kable_styling(latex_options = "scale_down") because my table was too wide. now my values are no longer aligned horizontally. i would like to align them horizontally to the decimal places - do you have any ideas on how to do this? thanks in advance and greetings from switzerland 😄
Maybe try the column_spec() function?
Here is the data: github.com/eteitelbaum/course-datasets/blob/main/dem_summary.csv
Data is here: github.com/eteitelbaum/course-datasets/blob/main/dem_women.csv
Here is the data for this code-along: github.com/eteitelbaum/course-datasets/blob/main/dem_waves_ctrs.csv
Please find the data here: github.com/eteitelbaum/course-datasets/blob/main/dem_women.csv
I prefer the visual editor but there are times when the visual editor will not work (but render still does). It is therefore useful to have some basic knowledge of the markdown. Nice intro by the way.
Thanks!
This is really great. thanks!
4:38
I would make the window a little bigger - otherwise it is hard to read (even at the highest resolution). Also a dark background would be better on the eyes.
Good suggestion, thanks.
Great stuff! I am actually more interested in how you built the course page and syllabus. There is not a lot of information out there about that since Quarto is relatively "new" (it is actually just LaTeX dressed up by R).
Thanks, I might make a video on this soon. In the meantime have a look at my GitHub repo for the code I use to produce my course websites: github.com/eteitelbaum
There seems to be two approaches for how to build the syllabus. One is to have it all in a single .qmd - the other to generate a book and enter each part as a chapter.
@@haraldurkarlsson1147 You are going to want a website project where the quarto.yml file is going to enable you to coordinate multiple different qmd files. When you select new project select "website" to get started. Here is the repo for the site you saw in that video: github.com/eteitelbaum/psc2339-spring-2023
Thanks for the tip.@@emmanuelteitelbaum
Good video - it would be nice to see a follow-up with some of the kableExtra options used.
Thanks for the suggestion!
thanx sir, i find this very helpful
You're welcome!
Very interesting but seems overly complicated when dealing with students who are just learning how to code.
Depends on the focus of the course. Data science students like it. Also this course has prerequisites and assumes some knowledge of R.
I am absolutely blown away by how the social sciences have embraced open source software like R. We in the physical sciences are stuck in the past and content with programs like Excel.@@emmanuelteitelbaum
Emmanuel - I was wondering how you made your hex sticker for the course? Did you use a R package or build it in some other program like LaTeX or imagemagick (magick in R)?
th-cam.com/video/O34vzdHOaEk/w-d-xo.htmlsi=jPFTjtuy8WxNloEd
It’s with a package called hexSticker
I am familar with it but found it to be a bit tricky. I have not (yet) found many good videos on how to use it.@@emmanuelteitelbaum
Mac comes preinstalled with git.
Emmanuel - These lessons are very informative. However, I wish you would make the script font a bit bigger and even go with a dark blackground.
Thanks for the excellent suggestion!
Excellent way to illustrate some of the most important features of gt(). It provided me with an excellent template. Explanation is also down to earth.
Thanks! I am glad it was helpful to you.
I try using the starter-academic theme, but it doesn't have the home folder. Any one know what's up with that?
I got the same error too
Amazing!
Hi, guys. I got a strange problem. Some shortcuts work in Rmarkdown, but not in Quarto. For example, Insert Assignment Operator, Insert Pipe Operator. Anyone runs into the same problem?
Are you in the "Visual" editor or the "Source" editor? For me it is working in the source editor but not the visual editor. Might be worth raising in the Quarto-CLI discussion forum on GitHub. github.com/quarto-dev/quarto-cli/discussions
@@emmanuelteitelbaum Neither. Do not work either in source or visual.
@@CanDoSo_org Not sure then. I would try the Quarto CLI discussion forum...
@@emmanuelteitelbaum Thanks, man. I solved the issue by updating the Quarto. By the way, how come there is no automatically way to update the Quarto. I don't even know it was out of date.
Hi Emmanuel! Thank your fantastic video, which is really helpful. But I'm not sure how to put my photo to the left in the first page and add my education part like yours. Can you help me here?
Doesn't like & ?
Splendid tutorial!
Have you tried to generate a class syllabus in Quarto? That would be very useful and appreciated by many (I know there are some in RMarkdown but those are pdf only).
Yes, check out my course website: www.psc2339.com/
It's based on this template by Mine Cetinkaya-Rundel: sta210-s22.github.io/website/
@@emmanuelteitelbaum Wow - that looks nice.
I think the mess up in bibliography might be in the bibliography part. I used bibtex in my doc and it worked fine.
The references building (bibtex) and cross-references (auto-labelling figures, equations etc) is all straight from LaTeX
Interesting - the pdf looks much like what LaTeX does. LaTeX has "usepackages" that will generate either random latin text, or text in the style of Kant or even random math equations. In fact I think one of the authors of Quarto stated that they were deeply influenced by how LaTeX works when the designed Quarto.
Yes, it is based on Pandoc, which can convert to LaTeX.
So is revealjr better than (LaTeX) Beamer?
It depends on what you want to do, but I like revealjs because it is more dynamic and interactive. See the quarto gallery for more examples: quarto.org/docs/gallery/
Neat! I like the "moon" theme.
Professor,many thanks for your sharing. I‘d like to ask why am I getting an error in Want to serve and preview the site now? (y/n) y, the error is as follows: Error: Error building site: "C:\Users\psyyxq\Documents\myprojects\CV\Academic-resume\content \slides\example\index.md:83:1": failed to extract shortcode: template for shortcode "fragment" not found
Better than others tutorial.
Hello, I was following the video. So while Creating the new site in R studio it gives me an error saying "cannot open file" and index.Rmd file was not created. Hence didn't get the option to start and preview the site. Kindly help.
Hi Pratik, Please see my update in the description. It seems Hugo Academic and blogdown are having some compatibility issues. You might want to try posting your issue to github.com/rstudio/blogdown and see if you get a helpful response there to see if folks know whether it is related to these ongoing compatibility problems or something else.