Performing Operations on Multiple Lists simultaneously in R Programming - mapply() Function Last Updated : 08 Nov, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report mapply() function in R Language is stand for multivariate apply and is used to perform mathematical operations on multiple lists simultaneously. Syntax: mapply(func, list1, list2, ...) Parameters: list1, list2, ...: Created Listsfunc: operation to be appliedmapply() Function in R Language ExampleExample 1: Sum of two lists using mapply() function in R R # R program to illustrate # mapply() function # Creating a list A = list(c(1, 2, 3, 4)) # Creating another list B = list(c(2, 5, 1, 6)) # Applying mapply() result = mapply(sum, A, B) print(result) Output: [1] 24Example 2: Product of two lists using mapply() function in R R # R program to illustrate # mapply() function # Creating a list A = list(c(1, 2, 3, 4)) # Creating another list B = list(c(2, 5, 1, 6)) # Applying mapply() result = mapply(prod, A, B) print(result) Output: [1] 1440Example 3: mapply() function with multiple arguments R Data1 <- c(1,2,3) Data2 <- c(10,20,30) mult_one<-function(Data1,Data2) { Data1+Data2 } mapply(mult_one,Data1,Data2) Output: 11 22 33 Comment More infoAdvertise with us Next Article Apply a Function over a Ragged Array in R Programming - tapply() Function N nidhi_biet Follow Improve Article Tags : R Language R List-Function Similar Reads Operations on Lists in R Programming Lists in R language, are the objects which comprise elements of diverse types like numbers, strings, logical values, vectors, list within a list and also matrix and function as its element. A list is generated using list() function. It is basically a generic vector that contains different objects. R 4 min read Convert an Object to List in R Programming - as.list() Function as.list() function in R Programming Language is used to convert an object to a list. These objects can be Vectors, Matrices, Factors, and dataframes. Syntax: as.list(object) Parameters: object: Vector, Matrix, factor, or data frame R - as.list() Function ExampleExample 1: Converting Vector to list 2 min read Applying a Function over an Object in R Programming - sapply() Function sapply() function in R Language takes list, vector or data frame as input and gives output in vector or matrix. It is useful for operations on list objects and returns a list object of same length of original set. Syntax: sapply(X, FUN) Parameters: X: A vector or an object FUN: Function applied to e 1 min read Recursively apply a Function to a List in R Programming - rapply() function rapply() function in R Language is used to recursively apply a function to a list. Syntax: rapply(object, f, classes = "ANY", deflt = NULL, how = c("unlist", "replace", "list")) Parameters: object: represents list or an expression f: represents function to be applied recursively classes: represents 3 min read Apply a Function over a Ragged Array in R Programming - tapply() Function tapply() function in R Language is used to apply a function over a subset of vectors given by a combination of factors Syntax: tapply(vector, factor, fun) Parameters: vector: Created Vector factor: Created Factor fun: Function to be applied Example 1: Python3 1== # R Program to apply a function # ov 1 min read Convert an Object to Data Frame in R Programming - as.data.frame() Function as.data.frame() function in R Programming Language is used to convert an object to data frame. These objects can be Vectors, Lists, Matrices, and Factors. Syntax: as.data.frame(object) Parameters: object: Vector, Matrix, factor, or data frameR - as.data.frame() Function ExampleExample 1: Basic exam 2 min read Like