I have 2 vectors, x
and y
:
x <- seq(from=21.6, to=22, by=0.01)
y <- seq(from=58.77, to=58.93, by=0.01)
I want to create a data frame df1<-data.frame(x,y)
with all the possible combinations of x
and y
. How can I do this?
I have 2 vectors, x
and y
:
x <- seq(from=21.6, to=22, by=0.01)
y <- seq(from=58.77, to=58.93, by=0.01)
I want to create a data frame df1<-data.frame(x,y)
with all the possible combinations of x
and y
. How can I do this?
We can use expand.grid
to get all the possible combinations between the two vectors.
expand.grid(x,y)