Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explainer Assignment #23

Open
Jigarci3 opened this issue Oct 1, 2019 · 12 comments
Open

Explainer Assignment #23

Jigarci3 opened this issue Oct 1, 2019 · 12 comments

Comments

@Jigarci3
Copy link

Jigarci3 commented Oct 1, 2019

Hello,
Is there a set due date for the explainer assignment listed on the syllabus? Should this assignment be posted on YellowDig?

Thanks!

@etbartell
Copy link

I remember him saying it would be due at the end of the course. He said last week that he would be posting it sometime this week. But yeah, hopefully we get a little more guidance on that soon. I still have no idea what my topic for that will be.

@lecy
Copy link
Collaborator

lecy commented Oct 3, 2019

@lecy
Copy link
Collaborator

lecy commented Oct 3, 2019

Key instructions here:

For this assignment your code-through should be short and simple. It can be as short as two printed pages

@Jigarci3
Copy link
Author

Jigarci3 commented Oct 4, 2019 via email

@castower
Copy link

Hello all,

Does anyone know if it's okay if we use shiny for the code-through assignment? Or is that too complicated and we should stick to just a basic rmd?

Thanks!

@lecy
Copy link
Collaborator

lecy commented Oct 10, 2019

My advice is usually to keep it simple and layer on complexity as you go. But I also encourage your to challenge yourself.

The one caveat is you can't share an shiny HTML file directly, you would have to upload it to shinyapp.io like your dashboard and share the link to that on YellowDig. You would submit your RMD file and that link then.

@castower
Copy link

My advice is usually to keep it simple and layer on complexity as you go. But I also encourage your to challenge yourself.

The one caveat is you can't share an shiny HTML file directly, you would have to upload it to shinyapp.io like your dashboard and share the link to that on YellowDig. You would submit your RMD file and that link then.

@lecy I decided to try to utilize shiny, but I'm a bit confused on what I'm doing wrong. My selection tab works fine, but it doesn't produce a plot. Here's is my code:


library(shiny)

inputPanel(
  selectInput("category", label = "Select Category:",
              choices = c("Age", 
                          "Location" = "Area",
                          "Level of Education" = "College",
                          "Continent",
                          "Gender",
                          "Homelessness" = "Housing",
                          "Internet Access" = "Internet",
                          "First Language" = "Language (first)",
                          "Literacy Level" = "Literacy",
                          "Nutrition",
                          "Cell Phone Access" = "Phones",
                          "Poverty",
                          "Religion",
                          "Water Access" = "Water"), 
              selected = "Religion")

)

renderPlot({
  
InteractiveWaffle <- 
  People %>% 
  filter( Category %in% input$category )
  
  
ggplot(InteractiveWaffle, aes(fill = Subcategory, values = Value)) +
  geom_waffle(color = "white", size=1.125, n_rows= 5) +
  facet_wrap(~Category, ncol=1,) +
  scale_x_discrete(expand=c(0,0)) +
  scale_y_discrete(expand=c(0,0)) +
  ggthemes::scale_fill_tableau(name=NULL) +
  coord_equal() +
  labs(
    title = "If The World Was 100 People"
  ) +
  theme_ipsum_rc(grid="") +
  theme_enhance_waffle()  

})

@castower
Copy link

Also, here is the code for my static waffle. It works fine:


library(hrbrthemes)
library(waffle)
library(tidyverse)


ggplot(ContData, aes(fill = Subcategory, values = ContData$Value)) +
  geom_waffle(color = "white", size=1.125, n_rows= 5) +
  facet_wrap(~Category, ncol=1,) +
  scale_x_discrete(expand=c(0,0)) +
  scale_y_discrete(expand=c(0,0)) +
  ggthemes::scale_fill_tableau(name=NULL) +
  coord_equal() +
  labs(
    title = "If The World Was 100 People"
  ) +
  theme_ipsum_rc(grid="") +
  theme_enhance_waffle()

@lecy
Copy link
Collaborator

lecy commented Oct 11, 2019

What is ContData? There is no data source listed here.

@lecy
Copy link
Collaborator

lecy commented Oct 11, 2019

@castower Are these columns? Should this be select() instead of filter()? I have no idea what your data looks like.

InteractiveWaffle <- 
  People %>% 
  filter( Category %in% input$category )

@lecy
Copy link
Collaborator

lecy commented Oct 11, 2019

To preview the data on a discussion board try:

dput( head( People ) ) %>% pander()

It should return markdown code that you can paste here.

@castower
Copy link

castower commented Oct 11, 2019

@lecy

I removed the inputPanel() function and restarted RStudio and it has started working!

Here is the output of the data, for reference though in case it may be helpful to anyone else:

-----------------------------------
 Category     Subcategory    Value 
----------- --------------- -------
 Continent       Asia         60   

 Continent      Africa        16   

 Continent   South America     9   

 Continent   North America     5   

 Continent      Europe        10   

  Gender        Female        50   
-----------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants