I have written a function that takes three arguments:
create.template <- function(t.list, x, y){
temp <- cbind(get(t.list[x]), get(t.list[y]), NA)
}
The output of this function is a data.frame with 11 columns and 17 rows.
Now I would like to create a loop over the function with two lists, one for x and one for y. Thereby
x.list <- list(1,2,3)
y.list <- list(4,5,6)
In the final step I would like to establish something like
for (x in x.list and y in y.list){
create.template(t.list, x, y)
}
and possibly combine the resulting dataframes (3 dataframes with 11 columns each) rowwise in one final dataframe.
I know that you can do this in Python with the zip() function and then append the results easily by append() and concatenate(), but I have not found an equivalent in R so far. Any help is highly appreciated!