Thread for students in Gov 50 to post reprexes. Please do not answer them!

8 = 2 + 2 + chocolate
#> Error in 8 = 2 + 2 + chocolate: invalid (do_set) left-hand side to assignment

Created on 2020-09-23 by the reprex package (v0.3.0)

qscores %>%
  filter(department = "HISTLIT")
#> Error in qscores %>% filter(department = "HISTLIT"): could not find function "%>%"

Created on 2020-09-23 by the reprex package (v0.3.0)

qscores %>% filter(department = "GOV")
#> Error in qscores %>% filter(department = "GOV"): could not find function "%>%"

Created on 2020-09-23 by the reprex package (v0.3.0)

7 = 2 + 2 + fish
#> Error in 7 = 2 + 2 + fish: invalid (do_set) left-hand side to assignment
7 = 2 + 2 + fish
#> Error in 7 = 2 + 2 + fish: invalid (do_set) left-hand side to assignment

Created on 2020-09-23 by the reprex package (v0.3.0)

x = "hello"
x + "bye"
#> Error in x + "bye": non-numeric argument to binary operator

Created on 2020-09-23 by the reprex package (v0.3.0)

x = "hello"
x + "bye"
#> Error in x + "bye": non-numeric argument to binary operator

Created on 2020-09-23 by the reprex package (v0.3.0)

x = "hello"
x + "bye"
#> Error in x + "bye": non-numeric argument to binary operator

Created on 2020-09-23 by the reprex package (v0.3.0)

x = "hello"
x + "bye"
#> Error in x + "bye": non-numeric argument to binary operator

Created on 2020-09-23 by the reprex package (v0.3.0)

y <- 75
x <- 6
x + y
#> [1] 81

Created on 2020-09-23 by the reprex package (v0.3.0)

x <- 6
x + 7 
#> [1] 13

Created on 2020-09-23 by the reprex package (v0.3.0)

print(hi)
#> Error in print(hi): object 'hi' not found

Created on 2020-09-23 by the reprex package (v0.3.0)

print(hi)
#> Error in print(hi): object 'hi' not found

Created on 2020-09-23 by the reprex package (v0.3.0)

# install.packages("reprex")
library(reprex)
library(dslabs)
library(tidyverse)
data("murders")
murders %>% 
  mutate(rate = (totel/population)*1e5)
#> Error: Problem with `mutate()` input `rate`.
#> x object 'totel' not found
#> ℹ Input `rate` is `(totel/population) * 1e+05`.
# install.packages("reprex")
library(reprex)
library(dslabs)
library(tidyverse)
data("murders")
murders %>% 
  mutate(rate = (totel/population)*1e5)
#> Error: Problem with `mutate()` input `rate`.
#> x object 'totel' not found
#> ℹ Input `rate` is `(totel/population) * 1e+05`.
library(reprex)
library(dslabs)
library(tidyverse)

data("murders") %>%
  mutate(rate = (totel/population) * 1e5)
#> Warning: `mutate_()` is deprecated as of dplyr 0.7.0.
#> Please use `mutate()` instead.
#> See vignette('programming') for more help
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.
#> Error in UseMethod("mutate_"): no applicable method for 'mutate_' applied to an object of class "character"

Help, I am getting an error while working on this in my Stat class.

## you can put any code here!
library(tidyverse)
library(PPBDS.data)

shaming %>%
  group_by(does_not_exist) 
#> Error: Must group by variables found in `.data`.
#> * Column `does_not_exist` is not found.
mutate (birht_year == "Year")
#> Error in mutate(birht_year == "Year"): object 'birht_year' not found

I have a bug that needs to be fixed. Help please.

## you can put any code here!
library(tidyverse)
library(PPBDS.data)

trains %>%
  filter_by(Democrat)
#> Error in filter_by(., Democrat): could not find function "filter_by"

Help! A bug!

## you can put any code here!
  library(tidyverse)
  library(PPBDS.data)
  
shaming %>% 
 select(maps, code)
#> Error: Can't subset columns that don't exist.
#> x Column `maps` doesn't exist.

Here's my fake problem:

library(tidyverse)
library(gapminder)

gapminder %>%
  filter(country == "Afghanistan") %>%
  ggplot(aes(x = year, y = lifeExp)) %>%
  geom_point()
#> Error: `mapping` must be created by `aes()`
#> Did you use %>% instead of +?