search for: dummylist

Displaying 3 results from an estimated 3 matches for "dummylist".

2008 Nov 04
2
strange list structure question
...A) return the name GGG from the lapply and B) use the name GGG in the function that is called inside the lapply ? Thanks for any suggestions on doing both ? I always think that I understand lists and then I always end up finding a new problem that i hadn't seen before. # EXAMPLE ONE dummylist <- list(list(x=1,y=2,z=3)) names(dummylist) <- "GGG" print(dummylist) print(str(dummylist)) # THIS RETURNS THE NAME GGG AT THE TOP LEVEL one <- lapply(dummylist, function(.sublist) { lapply(1:3, function(.index) { # could use a for loop here or whatever. it doesn'...
2018 Mar 04
0
Change Function based on ifelse() condtion
...he mclapply() function strips off the mc.cores argument from the "..." list before calling FUN, so FUN is being called with zero arguments, exactly as it is declared. A quick workaround is to change the line Lapply_me(as.list(1:4), function(xx) { to Lapply_me(as.list(1:4), function(xx,dummyList) { HTH, Eric On Sun, Mar 4, 2018 at 7:21 PM, Christofer Bogaso < bogaso.christofer at gmail.com> wrote: > Below is my full implementation (tried to make it simple as for > demonstration) > > Lapply_me = function(X = X, FUN = FUN, Apply_MC = FALSE, ...) { > if (Apply_MC) { &...
2018 Mar 04
3
Change Function based on ifelse() condtion
Below is my full implementation (tried to make it simple as for demonstration) Lapply_me = function(X = X, FUN = FUN, Apply_MC = FALSE, ...) { if (Apply_MC) { return(mclapply(X, FUN, ...)) } else { if (any(names(list(...)) == 'mc.cores')) { myList = list(...)[!names(list(...)) %in% 'mc.cores'] } return(lapply(X, FUN, myList)) } } Lapply_me(as.list(1:4), function(xx) { if (xx ==