R中的茎叶图错误'|'位置

时间:2019-12-06 04:55:23

标签: r plot

我有80到100之间的整数x1列表。

x=round(runif(100, min=80, max=100))  X1

但是,当我尝试绘制茎叶图时。看来R会将其视为91.0、81.0等。

stem(x)

x2

所需的输出应在左侧仅一个数字。 desired output

我尝试了stem(x1/10)stem(x1, scale=1/2/3)stem(trunc(x1)),但是它们都不起作用。

1 个答案:

答案 0 :(得分:0)

不是整数与双精度问题。问题在于值的范围太小,无法用第二个数字创建足够大的茎叶图。

您可以简单地通过传递atom的值来更改公差以获得所需的结果:

stem(x1,atom=10)

输出为:

  The decimal point is 1 digit(s) to the right of the |

   8 | 0000111122222333444
   8 | 555666666777778888999999999
   9 | 000111122223333444444
   9 | 55556666666677777788888999999
  10 | 0000