I can see from this link that R's equivalent of seq is n:m in (http://www.johnmyleswhite.com/notebook/2012/04/09/comparing-julia-and-rs-vocabularies/).
But the case of seq(a,b, length.out = n)
is not covered.
For example seq(1, 6, length.out=3)
gives c(1.0, 3.5, 6.0)
. It is a really nice way to specify the number of outputs.
What's its equivalent in Julia?
As of Julia 1.0:
linspace
has been deprecated. You can still use range
:
julia> range(0, stop = 5, length = 3)
0.0:2.5:5.0
As @TasosPapastylianou noted, if you want this to be a vector of values, you can use collect
:
julia> collect( range(0, stop = 5, length = 3) )
3-element Array{Float64,1}:
0.0
2.5
5.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With