简体   繁体   中英

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(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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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