簡體   English   中英

R中的莖葉圖錯誤'|' 位置

[英]stem and leaf plot in R wrong '|' position

我有一個 80 和 100 之間的整數x1列表。

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

但是,當我嘗試繪制莖葉圖時。 似乎 R 將它們視為 91.0、81.0 等。

stem(x)

x2

所需的輸出應該只有左邊的一個數字。 期望的輸出

我已經嘗試過stem(x1/10)stem(x1, scale=1/2/3)stem(trunc(x1))但它們都不起作用。

不是整數與雙精度的問題。 問題是值的范圍太小,無法用第二個數字創建足夠大的莖葉圖。

您可以簡單地更改容差以獲得您想要的結果,只需為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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM