Thread for students posting practice reprexes. Please do not answer them!

I teach a free 8 weeks data science course to high school students. One of their assignments is to use the reprex package to post a question to this forum. They must post the question in this thread. Please do not answer these questions!

Testing that students can post.

library(tidyverse)
ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-05 with reprex v2.1.0

library(tidyverse)

ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-09 with reprex v2.1.0

library(tidyverse)
ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-09 with reprex v2.1.0

library(tidyverse)
ggplot(data = mtcars,
mapping = aes(x = cyl, y = mpga)) +
geom_col()
#> Error in geom_col():
#> ! Problem while computing aesthetics.
#> :information_source: Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

library(tidyverse)

ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-09 with reprex v2.1.0

library(tidyverse)
ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-10 with reprex v2.1.0

ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in ggplot(data = mtcars, mapping = aes(x = cyl, y = mpga)): could not find function "ggplot"

Created on 2024-06-10 with reprex v2.1.0

library(tidyverse)
library(ggplot2)

ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-10 with reprex v2.1.0

library(tidyverse)
  ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found
library(tidyverse)
ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-11 with reprex v2.1.0

ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in ggplot(data = mtcars, mapping = aes(x = cyl, y = mpga)): could not find function "ggplot"

Created on 2024-06-11 with reprex v2.1.0

library(tidyverse)

ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-11 with reprex v2.1.0

library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 4.3.3
#> Warning: package 'ggplot2' was built under R version 4.3.3
#> Warning: package 'tidyr' was built under R version 4.3.3
#> Warning: package 'readr' was built under R version 4.3.3
#> Warning: package 'purrr' was built under R version 4.3.3
#> Warning: package 'dplyr' was built under R version 4.3.3
#> Warning: package 'stringr' was built under R version 4.3.3

ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found
#> Backtrace:
#>      ▆
#>   1. ├─base::tryCatch(...)
#>   2. │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#>   3. │   ├─base (local) tryCatchOne(...)
#>   4. │   │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#>   5. │   └─base (local) tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
#>   6. │     └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#>   7. │       └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#>   8. ├─base::withCallingHandlers(...)
#>   9. ├─base::saveRDS(...)
#>  10. ├─base::do.call(...)
#>  11. ├─base (local) `<fn>`(...)
#>  12. ├─global `<fn>`(input = base::quote("large-unau_reprex.R"))
#>  13. │ └─rmarkdown::render(input, quiet = TRUE, envir = globalenv(), encoding = "UTF-8")
#>  14. │   └─knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
#>  15. │     └─knitr:::process_file(text, output)
#>  16. │       ├─xfun:::handle_error(...)
#>  17. │       ├─base::withCallingHandlers(...)
#>  18. │       └─knitr:::process_group(group)
#>  19. │         └─knitr:::call_block(x)
#>  20. │           └─knitr:::block_exec(params)
#>  21. │             └─knitr:::eng_r(options)
#>  22. │               ├─knitr:::in_input_dir(...)
#>  23. │               │ └─knitr:::in_dir(input_dir(), expr)
#>  24. │               └─knitr (local) evaluate(...)
#>  25. │                 └─evaluate::evaluate(...)
#>  26. │                   └─evaluate:::evaluate_call(...)
#>  27. │                     ├─evaluate (local) handle(...)
#>  28. │                     │ └─base::try(f, silent = TRUE)
#>  29. │                     │   └─base::tryCatch(...)
#>  30. │                     │     └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#>  31. │                     │       └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#>  32. │                     │         └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#>  33. │                     ├─base::withCallingHandlers(...)
#>  34. │                     ├─base::withVisible(value_fun(ev$value, ev$visible))
#>  35. │                     └─knitr (local) value_fun(ev$value, ev$visible)
#>  36. │                       └─knitr (local) fun(x, options = options)
#>  37. │                         ├─base::withVisible(knit_print(x, ...))
#>  38. │                         ├─knitr::knit_print(x, ...)
#>  39. │                         └─knitr:::knit_print.default(x, ...)
#>  40. │                           └─evaluate (local) normal_print(x)
#>  41. │                             ├─base::print(x)
#>  42. │                             └─ggplot2:::print.ggplot(x)
#>  43. │                               ├─ggplot2::ggplot_build(x)
#>  44. │                               └─ggplot2:::ggplot_build.ggplot(x)
#>  45. │                                 └─ggplot2:::by_layer(...)
#>  46. │                                   ├─rlang::try_fetch(...)
#>  47. │                                   │ ├─base::tryCatch(...)
#>  48. │                                   │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#>  49. │                                   │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#>  50. │                                   │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#>  51. │                                   │ └─base::withCallingHandlers(...)
#>  52. │                                   └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
#>  53. │                                     └─l$compute_aesthetics(d, plot)
#>  54. │                                       └─ggplot2 (local) compute_aesthetics(..., self = self)
#>  55. │                                         └─base::lapply(aesthetics, eval_tidy, data = data, env = env)
#>  56. │                                           └─rlang (local) FUN(X[[i]], ...)
#>  57. └─base::.handleSimpleError(`<fn>`, "object 'mpga' not found", base::quote(NULL))
#>  58.   └─rlang (local) h(simpleError(msg, call))
#>  59.     └─handlers[[1L]](cnd)
#>  60.       └─cli::cli_abort(...)
#>  61.         └─rlang::abort(...)

Created on 2024-06-11 with reprex v2.0.2

library(tidyverse)
library(ggplot2)
library(tutorial.helpers)
ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-11 with reprex v2.1.0

library(tidyverse)

ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found
library(tidyverse)
library(reprex)
ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-11 with reprex v2.1.0

search()
 [1] ".GlobalEnv"               "package:reprex"          
 [3] "package:tutorial.helpers" "package:lubridate"       
 [5] "package:forcats"          "package:stringr"         
 [7] "package:dplyr"            "package:purrr"           
 [9] "package:readr"            "package:tidyr"           
[11] "package:tibble"           "package:ggplot2"         
[13] "package:tidyverse"        "tools:rstudio"           
[15] "package:stats"            "package:graphics"        
[17] "package:grDevices"        "package:utils"           
[19] "package:datasets"         "package:methods"         
[21] "Autoloads"                "package:base"            

ऀ
#> Error: <text>:2:2: unexpected '['
#> 1: search()
#> 2:  [
#>     ^
#> Error: <text>:2:2: unexpected '['
#> 1: search()
#> 2:  [
#>     ^

Created on 2024-06-11 with reprex v2.1.0

library(tidyverse)

ggplot(data = mtcars, 
       mapping = aes(x = cyl, y = mpga)) +
  geom_col()
#> Error in `geom_col()`:
#> ! Problem while computing aesthetics.
#> ℹ Error occurred in the 1st layer.
#> Caused by error:
#> ! object 'mpga' not found

Created on 2024-06-10 with reprex v2.1.0