John Akwei
mapply() works with multivariate arrays, and applys a
Exercise 5
Intermediate level
Use mapply() to paste the vector 1:4 and 5:8, with the separator
LETTERS[1:4].
Learn more about mapply, and the entire family of apply() functions in the
online course Learn R by Intensive Practice. In this course you will learn
how to:
Do any sort of manipulation with datasets
Create and master the manipulation of vectors, lists, dataframes, and
matrices
Confidently write apply() functions and design any logic within the
apply function.
Melt, reshape, aggregate, and make pivot tables from dataframes
And much more
Exercise 6
Intermediate level
Use mapply() to paste PersonnelData$Representative,
PersonnelData$Sales, and PersonnelData$Territory, with the
MoreArgs= argument of list(sep="-").
Exercise 7
Advanced level
Required variable:
NewSales <- data.frame(Representative=c(1:4), Sales=c(104, 97,
112, 94), Territory=c(1:4))
Exercise 8
Advanced level
Required function:
merge.function <- function(x,y){return(x+y)}
Exercise 9
Advanced level
mcmapply is a parallelized version of mapply.
Required library:
library(parallel)
To leave a comment for the author, please follow the link and comment
on their blog: R-exercises.
R-bloggers.com offers daily e-mail updates about R news and tutorials
on topics such as: Data science, Big Data, R jobs, visualization (ggplot2,
Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL,
Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time
series, trading) and more...