Open bensoltoff opened 2 years ago
I'm trying to calculate the number of diamonds by color but my count()
function is not working. Does anyone know why?
> library(tidyverse)
── Attaching packages ─────────────────────────────────────────────────────────── tidyverse 1.3.1 ──
✔ ggplot2 3.3.6 ✔ purrr 0.3.4
✔ tibble 3.1.7 ✔ dplyr 1.0.9
✔ tidyr 1.2.0 ✔ stringr 1.4.0
✔ readr 2.1.2 ✔ forcats 0.5.1
── Conflicts ────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
> count(diamonds, colour)
Error in `group_by()`:
! Must group by variables found in `.data`.
✖ Column `colour` is not found.
Run `rlang::last_error()` to see where the error occurred.
library(tidyverse)
count(diamonds, colour)
#> Error in `group_by()`:
#> ! Must group by variables found in `.data`.
#> ✖ Column `colour` is not found.
Created on 2022-07-05 by the reprex package (v2.0.1)
mean(rnorm(100))
#> [1] 0.01962445
Created on 2022-07-05 by the reprex package (v2.0.1)
This doesn't work. Why not?