I was trying to find out info about .mapply but did not find any good explanation. So could anyone explain the difference between mapply and .mapply?
Example:
Why does
.mapply(cbind,mylist,NULL)
works but not:
mapply(cbind,mylist,NULL)
?
mylist=list(list(data.frame(a=3,b=2,c=4),data.frame(d=5,e=6,h=8),data.frame(k=2,e=3,b=5,m=5)),
list(data.frame(a=32,b=22,c=42),data.frame(d=5,e=63,h=82),data.frame(k=2,e=33,b=5,m=5)),
list(data.frame(a=33,b=21,k=41,c=41),data.frame(d=5,e=61,h=80),data.frame(k=22,e=3,b=5,m=5)))
?
From
?.mapply:So .mapply is just a simple (less parameters) version of
mapplyto use in your own package. Indeedmapplycall internally.mapplyand then do some result simplification.UPDATE after OP edit
does not work because
NULLhere is considered as dots arguments and not theMoreArgsparameter. Indeed you reproduce the same error with.mapplyusing :You can avoid this error in
mapplyif you explicitly write the argument name ;But due to a the line in
mapply:You will not get the same result as with
.mapplyFinally, if you want just to
unlistyou nested list , better here to use something like :