I have the following tibble:
library(tidyverse)
tb <- structure(list(V2 = structure(c(2L, 1L, 4L, 3L, 2L, 1L, 4L, 3L
), .Label = c("bar", "foo", "gop", "qux"), class = "factor"),
V3m = c(9.394981, 6.826405, 1.074885, 1.493691, 1e-04, 2e-04,
3e-04, 4e-04)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-8L), .Names = c("V2", "V3m"))
Which looks like this:
> tb
# A tibble: 8 × 2
V2 V3m
<fctr> <dbl>
1 foo 9.394981
2 bar 6.826405
3 qux 1.074885
4 gop 1.493691
5 foo 0.000100
6 bar 0.000200
7 qux 0.000300
8 gop 0.000400
How can I round V3m
column to 2 digits? I tried this but failed:
tb %>% mutate(V3mR=format(V3m,2))