Pergunta

I can't find how to tell R that I want to make a kind of "continuous" vector.

I want something like x<-c(-1,1) to give me a vector of n values with a specific interval (e.g, 0.1 or anything I want) so I can generate a "continuous" vector such as

x
[1]  1.0 -0.9 -0.8 -0.7....1.0

I know this should be basic but I can't find my way to the solution.

Thank you

Foi útil?

Solução

It sounds like you're looking for seq:

seq(-1, 1, by = .1)
#  [1] -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1  0.0  0.1  0.2  0.3  0.4
# [16]  0.5  0.6  0.7  0.8  0.9  1.0
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top