Then I used the command bind_rows to join them.
But now I just want to generate the list that contains every object.
I tried doing It with paste0.
But when I use that list, I received an error:
list_res=paste0("res",1:3,"")
bind_rows(list_res)
Error: Argument 1 must have names.
Run `rlang::last_error()` to see where the error occurred.
I pretend to repeat this tak with 100 object, so that's why I need to generate the list declaring all the objects for joining.
Thanks for your time and interest, community.
Have a nice weekend.
sapply calls as.name on each string and returns a list of symbols (the variables res1-3). do.call calls bind_rows and, importantly, expands the list into individual arguments for bind_rows. This is like manually calling
lista=paste("res",1:3, sep="")
lista
res0=res1
zzz=res1
for (i in lista) {
texto=paste("zzz=bind_rows(zzz,",i,")",sep="")
print(texto)
eval(parse(text=texto))
}
zzz
It worked. Not the nicest code, but It does the job.
It's a shame I can't use purrr or across and num_range from tidyverse