基本信息
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Formula_1.2-3 survival_2.44-1.1 lattice_0.20-38 psych_1.8.12 ggplot2_3.2.0
[6] pacman_0.5.1
loaded via a namespace (and not attached):
[1] tidyselect_0.2.5 xfun_0.8 purrr_0.3.2 splines_3.6.1 colorspace_1.4-1
[6] htmltools_0.3.6 yaml_2.2.0 base64enc_0.1-3 rlang_0.4.0 pillar_1.4.2
在运行的过程中出现如下结果
gg <- ggplot(women,aes(x=rownames(women),y=height)) + geom_bar()
gg
Error: stat_count() must not be used with a y aesthetic.
我又换了一种输入,结果如下:
gg <- ggplot(NULL,aes(x=rownames(women),y=women$height)) + geom_bar()
gg
Error: stat_count() must not be used with a y aesthetic.
接着,我又换了一种输入,结果如下:
gg <- ggplot(NULL,aes(x=rownames(women))) + geom_bar(aes(y=women$height))
gg
Error: stat_count() must not be used with a y aesthetic.
这是为什么呢?下期解答。
网友评论