Q:

Merging lists of data frames with different length

I want to merge two lists of data frames. The lists have different length and the data frames in them also.
ls(df_list1)
 [1] "0"  "1"  "14" "15" "16" "19" "2"  "23" "25" "29" "3"  "31" "32" "33" "36" "38" "4"  "46" "48" "5"  "57" "6"  "61" "63"
[25] "7"  "8"  "9" 
ls(df_list2)
 [1] "0"  "1"  "10" "15" "16" "17" "19" "2"  "24" "26" "3"  "30" "32" "33" "34" "37" "39" "4"  "47" "49" "5"  "58" "6"  "62"
[25] "64" "7"  "8"  "9"

I want to merge every dataframe from df_list1 with every dataframe from df_list2.
Tried this, but I can`t save all the combinations to test, just the last merge from the cycle.
test=list()
for (i in 1:length(df_list1){
  for (j in 1:length(df_list2){
      test[[i]] <- inner_join(df_list1[[i]], df_list2[[j]], by="variable")
  }
}

Maybe something like this:
df_list1 <- list("0"=data.frame("variable" = c(2,4,8), "variable2" = c(13,14,53), "variable1" = "2019-05-31"),
                  "1"=data.frame("variable" = c(3,7,2), "variable2" = c(53,68,41), "variable1" = "2019-05-31"),
                  "4"=data.frame("variable" = c(6,5,6), "variable2" = c(24,52,83), "variable1" = "2019-05-31"))

df_list2 <- list("0"=data.frame("variable" = c(2,8,3), "variable2" = c(72,25,37), "variable1" = "2019-05-31"),
                  "3"=data.frame("variable" = c(2,7,6), "variable2" = c(24,62,45), "variable1" = "2019-05-31"),
                  "4"=data.frame("variable" = c(9,5,8), "variable2" = c(34,74,58), "variable1" = "2019-05-31"))

A:

I am not sure what is your desired output. With the data you provided in your post, I tried to make the minimal changes to your code to see if that is what you want:
Since you attempt to save all combinations, you should use for loop like below, where test[[length(test)+1]] is to update the test with newly generated combination:
test=list()
for (i in 1:length(df_list1)) {
  for (j in 1:length(df_list2)) {
    test[[length(test)+1]] <- inner_join(df_list1[[i]], df_list2[[j]], by="variable")
  }
}

If you want to produce a data frame of all combinations, then you can make it as below
df <- Reduce(rbind,test)

such that
> df
   variable variable2.x variable1.x variable2.y variable1.y
1         2          13  2019-05-31          72  2019-05-31
2         8          53  2019-05-31          25  2019-05-31
3         2          13  2019-05-31          24  2019-05-31
4         8          53  2019-05-31          58  2019-05-31
5         3          53  2019-05-31          37  2019-05-31
6         2          41  2019-05-31          72  2019-05-31
7         7          68  2019-05-31          62  2019-05-31
8         2          41  2019-05-31          24  2019-05-31
9         6          24  2019-05-31          45  2019-05-31
10        6          83  2019-05-31          45  2019-05-31
11        5          52  2019-05-31          74  2019-05-31

