applying commands on multiple lists in R -


i have 2 lists:

list.1 list.2 

i have command list of tables. works well:

foreach(x=iter(list.1)) %do% {      assign(x, mutate(get(x),  date = make_datetime(     shana, hodesh, taarich, shaa)) %>%     select( -shana, -hodesh, -taarich, -shaa)) # selecting relevant columns. } 

but want apply command multiple lists. tried write this, didn't go well:

foreach(x=iter(list.1 , list.2 )) %do% {     assign(x, mutate(get(x),  date = make_datetime(    shana, hodesh, taarich, shaa)) %>%    select( -shana, -hodesh, -taarich, -shaa)) # selecting relevant columns. } 

you can

lapply(list(list.1, list.2), function(list.i) {   foreach(x=iter(list.i)) %do%   {      assign(x, mutate(get(x),  date = make_datetime(       shana, hodesh, taarich, shaa)) %>%         select( -shana, -hodesh, -taarich, -shaa)) # selecting relevant columns.   } } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -