What is mapply in R?
MACHINE LEARNING RECIPES DATA CLEANING PYTHON DATA MUNGING PANDAS CHEATSHEET     ALL TAGS

What is mapply in R?

What is mapply in R?

This recipe explains what is mapply in R

0

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]]
[1] 2 2 2 2 2 2 2 2 2

[[3]]
[1] 3 3 3 3 3 3 3 3

[[4]]
[1] 4 4 4 4 4 4 4

[[5]]
[1] 5 5 5 5 5 5

[[6]]
[1] 6 6 6 6 6

[[7]]
[1] 7 7 7 7

[[8]]
[1] 8 8 8

[[9]]
[1] 9 9

[[10]]
[1] 10

Relevant Projects

Ensemble Machine Learning Project - All State Insurance Claims Severity Prediction
In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

Predict Churn for a Telecom company using Logistic Regression
Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

Machine Learning or Predictive Models in IoT - Energy Prediction Use Case
In this machine learning and IoT project, we are going to test out the experimental data using various predictive models and train the models and break the energy usage.

Time Series Forecasting with LSTM Neural Network Python
Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.

Data Science Project on Wine Quality Prediction in R
In this R data science project, we will explore wine dataset to assess red wine quality. The objective of this data science project is to explore which chemical properties will influence the quality of red wines.

Mercari Price Suggestion Challenge Data Science Project
Data Science Project in Python- Build a machine learning algorithm that automatically suggests the right product prices.

Build a Collaborative Filtering Recommender System in Python
Use the Amazon Reviews/Ratings dataset of 2 Million records to build a recommender system using memory-based collaborative filtering in Python.

Solving Multiple Classification use cases Using H2O
In this project, we are going to talk about H2O and functionality in terms of building Machine Learning models.

Credit Card Fraud Detection as a Classification Problem
In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

Human Activity Recognition Using Multiclass Classification in Python
In this human activity recognition project, we use multiclass classification machine learning techniques to analyse fitness dataset from a smartphone tracker.