Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate a vector containing a numeric sequence with a given step?

Tags:

r

I have a decimal variable x0.

I want to make a vector from [x0, 6] increasing by 0.01 each time.

I know it's something like c(x0:6, by=0.01) but that didn't work.

like image 751
CodeGuy Avatar asked Aug 20 '11 17:08

CodeGuy


People also ask

Which operator creates the series of numbers in sequence for a vector?

If you want to create a sequence vector containing numbers you use the : operator. For example, 1:15 will generate a vector with numbers between 1 and 15. To gain more control you can use the seq() method.


1 Answers

x0 = 5.9 seq(x0, 6, 0.01)  [1] 5.90 5.91 5.92 5.93 5.94 5.95 5.96 5.97 5.98 5.99 6.00 
like image 200
bnaul Avatar answered Sep 19 '22 18:09

bnaul