You can remove a particular element from a list as follows:
Mylist[[i]] <- NULL
This will remove the ith element from the list, where i is the index of that element.
Note: This method shuffles the index of elements after removing the element.
If you don’t want to modify the list, you can use negative indexing to not include a particular element.
For example:
x <- list("A", "B", "C", "D", "E")
x[-2]
x
Output 1:
[[1]]
[1] "A"
[[2]]
[1] "C"
[[3]]
[1] "D"
[[4]]
[1] "E"
Output 2:
[[1]]
[1] "A"
[[2]]
[1] "B"
[[3]]
[1] "C"
[[4]]
[1] "D"
[[5]]
[1] "E"