How to use sapply() function In R Language
Here we can access the elements from the sapply() using index numbers
Syntax:
sapply(list,"[",c(index))
Example: Subset List
R
# create list data= list (a= c (1:3),b= c (5:8), "geeks" ) # get elements of index 1 and 2 sapply (data, "[" , c (1,2)) |
Output:
How to Subset Lists in R?
In this article, we will discuss how to subset lists in R programming language.