What is mapply in R?

What is mapply in R?

What is mapply in R?

This recipe explains what is mapply in R

Recipe Objective

What is mapply in R? mapply () function is a multivariate type of sapply () function i.e mapply () accepts multiple arguments at a time. Syntax — **mapply (function,list)** function — a function like sum, etc is passed list — list of numbers on which the function will be applied This recipe demonstrates an example on mapply function..

Step 1 - Create a vector

a <- mapply(sum,1:10,1:10) # mapply sums up all the first elements, then second elements, and so on till the tenth elements. print(a)
"Output is ":  2  4  6  8 10 12 14 16 18 20 
a <- mapply(rep,1:10,10:1) # mapply repeats the first element 10 times, second element 9 times till the last element one time. print(a)
"Output is ": 
 [1] 1 1 1 1 1 1 1 1 1 1

[1] 2 2 2 2 2 2 2 2 2

[1] 3 3 3 3 3 3 3 3

[1] 4 4 4 4 4 4 4

[1] 5 5 5 5 5 5

[1] 6 6 6 6 6

[1] 7 7 7 7

[1] 8 8 8

[1] 9 9

[1] 10

Relevant Projects

Expedia Hotel Recommendations Data Science Project
In this data science project, you will contextualize customer data and predict the likelihood a customer will stay at 100 different hotel groups.

Resume parsing with Machine learning - NLP with Python OCR and Spacy
In this machine learning resume parser example we use the popular Spacy NLP python library for OCR and text classification.

PySpark Tutorial - Learn to use Apache Spark with Python
PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

Identifying Product Bundles from Sales Data Using R Language
In this data science project in R, we are going to talk about subjective segmentation which is a clustering technique to find out product bundles in sales data.

Inventory Demand Forecasting using Machine Learning in R
In this machine learning project, you will develop a machine learning model to accurately forecast inventory demand based on historical sales data.

Digit Recognition using CNN for MNIST Dataset in Python
In this deep learning project, you will build a convolutional neural network using MNIST dataset for handwritten digit recognition.

Predict Macro Economic Trends using Kaggle Financial Dataset
In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.

Data Science Project - Instacart Market Basket Analysis
Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

Classification of T shirt images to see if they have text on them
Want to search images of clothes which have text on them? Then this project talks through how we can classify an image whether it has text on it or not. For this we use state of the model called as inception and try and deepdive into how it works on our dataset

Locality Sensitive Hashing Python Code for Look-Alike Modelling
In this deep learning project, you will find similar images (lookalikes) using deep learning and locality sensitive hashing to find customers who are most likely to click on an ad.