在R中,从数据框列表中删除特定的数据框

3

我有一个大的数据帧列表。

我想要移除其中一个特定的数据帧,例如这个例子中的d2。

my.list
$d1
  y1 y2
1  1  4
2  2  5
3  3  6

$d2
  y1 y2
1  3  6
2  2  5
3  1  4

2
一种方法可能是:my.list[names(my.list) != "d2"] - patL
1
my_list[["d2"]] <- NULL - RLave
2个回答

8
几个选择:
# assign it to NULL
my.list$d2 = NULL
my.list[["d2"]] = NULL

# remove second item
my.list = my.list[-2]

# subset by  name
my.list = my.list[names(my.list) != "d2"]

4
这将从列表中删除第二个元素。
my.list = my.list[-2] 

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接