I am having trouble getting the desired number of decimal places from summarise. Here is a simple example:
test2 <- data.frame(c(\"a\",\"a\",\"b\",\"b\")
This is one solution-
test2 <- data.frame(c("a", "a", "b", "b"), c(245, 246, 247, 248))
library(dplyr)
colnames(test2) <- c("V1", "V2")
group_by(test2, V1) %>%
dplyr::summarise(mean(V2)) %>%
dplyr::mutate_if(is.numeric, format, 1)
#> # A tibble: 2 x 2
#> V1 `mean(V2)`
#>
#> 1 a 245.5
#> 2 b 247.5
Created on 2018-01-20 by the reprex package (v0.1.1.9000).