Skip to content
Prev 390973 / 398506 Next

stdev error

Hello,

I cannot reproduce this error with a built-in data set.
Can you post str(my_tbl)?


suppressPackageStartupMessages(library(dplyr))

mtcars %>%
   mutate(hp = round(hp * 2) / 2) %>%
   group_by(cyl, hp) %>%
   summarise(
     count = n(),
     hp = mean(hp),
     stdev = sd(hp)
   )
#> `summarise()` has grouped output by 'cyl'. You can override using the 
`.groups`
#> argument.
#> # A tibble: 23 x 4
#> # Groups:   cyl [3]
#>      cyl    hp count stdev
#>    <dbl> <dbl> <int> <dbl>
#>  1     4    52     1    NA
#>  2     4    62     1    NA
#>  3     4    65     1    NA
#>  4     4    66     2    NA
#>  5     4    91     1    NA
#>  6     4    93     1    NA
#>  7     4    95     1    NA
#>  8     4    97     1    NA
#>  9     4   109     1    NA
#> 10     4   113     1    NA
#> # ... with 13 more rows

Hope this helps,

Rui Barradas


?s 14:14 de 11/03/2022, Jeff Reichman escreveu: