How can I delete component from list in R?

前端 未结 4 1541
面向向阳花
面向向阳花 2021-01-21 08:23

I am trying to remove a component from list in R, but it is not working.

I have list like this:

> myList
[[1]]
[[1]][[1]]
[1] \"Sunny\"  \"Cloudy\" \"         


        
4条回答
  •  遥遥无期
    2021-01-21 08:29

    I think it's because you're lists are so heavily nested. I attempted to replicate your data and could using:

    (x <- list(c(list(c(1)),list(c(10:15)),list(c(2))),c(list(c(1:4)), list(c(3:5)))))
    

    I don't know if having a list this heavily nested is intentional or not but this may be where a great deal of your problems lie. You could try assigning NULL to the "components" as in:

    x[[1]][[1]][[1]] <- NULL
    

提交回复
热议问题