简体   繁体   English

如何按十分之一列出数字列表?

[英]How do I make a list of numbers by tenths?

我知道1:10会给我一个从1到10的所有整数的向量,但是我怎样才能得到从1到2的数字上升十分之一(即1.0,1.1,1.2,...,2.0)?

Try seq 尝试seq

> seq(1, 2, by = 0.1)
 [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0

Just in the spirit of there is more than one way to do things, another option is: 只是本着不止一种方式做事的精神,另一个选择是:

> (10:20)/10
 [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM