jitter()函数的使用
jitter()函数:对数值向量添加一个小的噪音量。
jitter(x,factor=1,amount=NULL)
·x:数值变量,需要加入噪音的数值向量;
·factor:数值型;
·amount:
例:
> round(jitter(c(rep(1,3),rep(1.2,4),rep(3,3))),3) [1] 0.995 1.017 1.032 1.201 1.200 1.164 1.180 3.023 2.976 3.030 > jitter(rep(0,7)) [1] -0.0054272884 -0.0092020010 0.0035989811 -0.0133819767 -0.0004372087 [6] 0.0185353459 0.0031841173 > jitter(rep(0,7)) [1] 0.011631916 0.003153848 0.001674986 0.010502867 -0.014309786 -0.004305730 0.012148331 > jitter(rep(10000,5)) [1] 10179.605 9815.381 10067.678 9865.233 9846.532 > jitter(rep(10000,5)) [1] 9852.969 9956.410 9886.297 10078.813 9862.851 > jitter(rep(10000,5)) [1] 9936.206 9933.250 10053.980 9962.283 10067.200 > jitter(rep(10000,5)) [1] 10198.031 10161.518 9936.120 9902.919 9928.875 > jitter(rep(10000,5)) [1] 9997.306 9807.569 9914.049 10063.483 9851.937 > jitter(rep(10000,5)) [1] 9846.340 9812.892 9915.440 10031.004 9815.422 > jitter(rep(10000,5)) [1] 10090.507 10158.549 10095.456 9962.090 9832.906 >