I've got two strings of variable names that looks like this
> names_a = paste(paste0('a', seq(0,6,1)), collapse = ", ")
> names_a
[1] "a0, a1, a2, a3, a4, a5, a6"> names_b = paste(paste0('b', seq(0,6,1)), collapse = ", ")
> names_b
[1] "b0, b1, b2, b3, b4, b5, b6"
Eacha
and b
variable contains a vector of ids, for example:
> head(a3)
[1] "1234""56567""457659"...
I aim to get all possible pairs of a
and b
ids. For this purpose I try to paste variables' names rigth into function rbind
and then to expand.grid
pairs = expand.grid(rbind(parse(text = names_a), rbind(parse(text = names_b))
I mean I try to collapse all a0
to a6
vectors into a single vector using rbind
, let it be named a
, the same for all b
's vectors and then find all pairs of values in a
and b
surprisingly nothing works. Can it be fixed?