I have a data frame in R. In one of the columns, I'm storing lists. I need to remove a number from all of the lists in this column that contain it.
example <- data.frame(matrix(NA_real_, nrow=10, ncol=1))
colnames(example) <- "col"
x <- list(c(1,2,3,4))
for(y in 1:10) {
example$col[y] <- x
}
This generates a data frame containing 10 lists of length 4 (containing the values 1,2,3,4). I want to remove each element from every sublist with a specific value (1 in this case). How can I do this in the most efficient way?