In R I merge two vectors a and b:
a <- c(100,250)
b <- c(0,100,200)
foo <- merge(a,b,all=TRUE)
When I inspect foo, I see that the merge function has named the two columns x and y:
> foo
x y
1 100 0
2 250 0
3 100 100
4 250 100
5 100 200
6 250 200
Is there an elegant way of keeping the original variable names as column names in the resulting data frame? By "elegant" I mean something simpler than explicitly renaming the columns.
expand.gridfor this use case. - TARehman