I am teaching reprex today, inspired by Mara Averick's lecture to my class last week. I want to provide a safe, but real, environment for the students to practice their data science "superpowers." So, they will post in this thread.
If this is a bad idea, or a violation of your service, let me know and I will find another way.
Any advice about teaching reprex or about how to use reprex to post questions here would be appreciated!
UPDATE: Sorry! They don't need answers to these questions. I should have made that more clear. The purpose was to force them to ask a question at least once, as well as to ensure that they have signed up for R Community. Thanks to all those who answered anyway!
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
#> Error in seq.default(min(x), max(x), length.out = input$bins + 1): object 'input' not found
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
#> Error in hist.default(x, breaks = bins, col = "darkgray", border = "white"): object 'bins' not found
So, I came across this error when working with data. Here is the code:
aggregate %>% mutate()
#> Error in aggregate %>% mutate(): could not find function "%>%"
``
I don't understand what is wrong.
<sup>Created on 2019-04-16 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1)</sup>
library(tidyverse)
library(gapminder)
gapminder %>%
ggplot(x = year, y = gdpPercap)+geom_point()
#> Error: geom_point requires the following missing aesthetics: x, y
data %>%
ggplot(aes(x = year, y = population, color = country, size = gdpPercap)) +
geom_point() +
scale_y_continuous() +
transition_states(year)
#> Error in data %>% ggplot(aes(x = year, y = population, color = country, : could not find function "%>%"
library(gapminder)
library(tidyverse)
gapminder %>%
filter(continent = c("Africa", "Asia"))
#> `continent` (`continent = c("Africa", "Asia")`) must not be named, do you
#> need `==`?
library(reprex)
library(tidyverse)
#> Warning: package 'ggplot2' was built under R version 3.5.2
#> Warning: package 'tibble' was built under R version 3.5.2
#> Warning: package 'tidyr' was built under R version 3.5.2
#> Warning: package 'purrr' was built under R version 3.5.2
#> Warning: package 'dplyr' was built under R version 3.5.2
#> Warning: package 'stringr' was built under R version 3.5.2
#> Warning: package 'forcats' was built under R version 3.5.2
cars %>%
filter(speed = 12)
#> `speed` (`speed = 12`) must not be named, do you need `==`?