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
Post a Comment