
## EXMAPLE 01
=============

# SAMPLE DATA
x = 1:3; y=LETTERS[1:3]

# EXAMPLE OF mapply;  SIMPLIFY=F  (returns list)
mapply(paste0, x, y, SIMPLIFY=F)

# EXAMPLE 1 OF mapply;  SIMPLIFY=T  (returns vector)
mapply(paste0, x, y, SIMPLIFY=T)

# EXAMPLE 2 OF mapply;  SIMPLIFY=T  (returns matrix)
mapply(c, x, y, SIMPLIFY=T)


  function(x, y) "[<-"(x, "SampleID", value = y) ,
       filelist, ID, SIMPLIFY = FALSE)




## EXMAPLE 02  (from stackoverflow)
=============

# SAMPLE DATA
df1 <- data.frame(x = 1:3, y=letters[1:3])
df2 <- data.frame(x = 4:6, y=letters[4:6])
filelist <- list(df1,df2)
ID <- c("1A","IB")

# USAGE
mapply(function(x, y) "[<-"(x, "SampleID", value = y) ,
       filelist, ID, SIMPLIFY = FALSE)




#############################
###  FROM  DOCUMENTATION  ###
#############################

Description

mapply is a multivariate version of sapply. 
mapply applies FUN to the first elements of 
each ... argument, the second elements, the third elements, and so on. 
Arguments are recycled if necessary.


Usage

mapply(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE)
