那如果新产生一个变量mpg1=mpg,或者new=mpg*cyl,就用到mutate函数,产生新变量。...dplyr::select(mpg,cyl,am,gear) %>%
mutate(mpg1=mpg,
new=mpg*cyl)
# A...譬如,对不同gear计算mpg的均值及标准差。或者根据am及gear分组计算mpg均值标注差。...(mpg),
new=factor(am))
df
# A tibble: 32 x 6
mpg cyl am gear mpg1 new
<dbl..."yes","no"),
mpg2=factor(mpg1),
mpg3=cut_number(mpg, n = 4),
mpg4=cut(mpg,