--4-The apply family
#1-lapply an the apply family: Apply family video: Part1, Part 2, Part 3​
#2-Use lapply with a built-in R function
#Have a look at the strsplit() calls,
#that splits the strings in pioneers on the : sign.
#The result, split_math is a list of 4 character vectors:
#the first vector element represents the name, the second element the birth year.
#Use lapply() to convert the character vectors in split_math to lowercase letters:
#apply tolower() on each of the elements in split_math. Assign the result,
#which is a list, to a new variable split_low.
#Finally, inspect the contents of split_low with str().
# The vector pioneers has already been created for you
pioneers <- c("GAUSS:1777", "BAYES:1702", "PASCAL:1623", "PEARSON:1857")
# Split names from birth year
split_math <- strsplit(pioneers, split = ":")
# Convert to lowercase strings: split_low
split_low<-lapply(split_math,FUN=tolower)
# Take a look at the structure of split_low
str(split_low)#3-Use lapply with your own function
#4-lapply and anonymous functions
#5-Use lapply with additional arguments
#6-Apply functions that return NULL
#7-sapply: Apply family video: Part1, Part 2, Part 3​
#8-How to use sapply
#9-sapply with your own function
#10-sapply with function returning vector
#11-sapply can't simplify, now what?
#12-sapply with functions that return NULL
#13-Reverse engineering sapply
#14-vapply: Apply family video: Part1, Part 2, Part 3​
#15-Use vapply
#16-Use vapply (2)
#17-From sapply to vapply
Last updated