I have this list with 5 tibbles that each consist of one row:

<list_of<
  tbl_df<
    one  : integer
    two  : integer
    three: integer
    four : integer
  >
>[5]>
[[1]]
# A tibble: 1 x 4
    one   two three  four
  <int> <int> <int> <int>
1     1     3     2     4

[[2]]
# A tibble: 1 x 4
    one   two three  four
  <int> <int> <int> <int>
1     2     0     1     5

[[3]]
# A tibble: 1 x 4
    one   two three  four
  <int> <int> <int> <int>
1     3     2     1     4

[[4]]
# A tibble: 1 x 4
    one   two three  four
  <int> <int> <int> <int>
1     4     9    11    19

[[5]]
# A tibble: 1 x 4
    one   two three  four
  <int> <int> <int> <int>
1     4     3     2     1
list <- structure(list(structure(list(one = 1L, two = 3L, three = 2L, 
    four = 4L), row.names = c(NA, -1L), class = c("tbl_df", "tbl", 
"data.frame")), structure(list(one = 2L, two = 0L, three = 1L, 
    four = 5L), row.names = c(NA, -1L), class = c("tbl_df", "tbl", 
"data.frame")), structure(list(one = 3L, two = 2L, three = 1L, 
    four = 4L), row.names = c(NA, -1L), class = c("tbl_df", "tbl", 
"data.frame")), structure(list(one = 4L, two = 9L, three = 11L, 
    four = 19L), row.names = c(NA, -1L), class = c("tbl_df", 
"tbl", "data.frame")), structure(list(one = 4L, two = 3L, three = 2L, 
    four = 1L), row.names = c(NA, -1L), class = c("tbl_df", "tbl", 
"data.frame"))), ptype = structure(list(one = integer(0), two = integer(0), 
    three = integer(0), four = integer(0)), class = c("tbl_df", 
"tbl", "data.frame"), row.names = integer(0)), class = c("vctrs_list_of", 
"vctrs_vctr", "list"))

My desired output should be a list of 5 vectors, something like this:

[[1]]
[1]     1     3     2     4

[[2]]
[1]     2     0     1     5

[[3]]
[1]     3     2     1     4

[[4]]
[1]     4     9    11    19

[[5]]
[1]     4     3     2     1

我现在try 了很长时间(首先想到的是一个简单的问题).但我没能解决它.

推荐答案

你可以unlist个藏书.

lapply(list, unlist, use.names = FALSE)

#[[1]]
#[1] 1 3 2 4

#[[2]]
#[1] 2 0 1 5

#[[3]]
#[1] 3 2 1 4

#[[4]]
#[1]  4  9 11 19

#[[5]]
#[1] 4 3 2 1

R相关问答推荐

在另存为PNG之前隐藏htmlwidget绘图元素

如何自定义3D散点图的图例顺序?

如何在PackageStatus()中列出&q;不可用的包&q;?

识别连接的子网(R-igraph)

如何将一些单元格的内容随机 Select 到一个数据框中?

我是否可以使用多个变异项来构建顺序列(标记多个问题)

将列表中的字符串粘贴到R中for循环内的dplyr筛选器中

在ggplot2上从多个数据框创建复杂的自定义图形

创建新列,其中S列的值取决于该行S值是否与其他行冗余

我正在try 创建一个接近cos(X)的值的While循环,以便它在-或+1-E10范围内

将日期列从字符转换为日期得到的结果是NAS

从字符串列中的向量中查找第一个匹配的单词

R:部分修改矩阵对角线的有效方法

即使使用相同的种子,mtry值也取决于TuneGrid范围

如何在用`{{ }}`创建的变量上使用整洁 Select ?

为各个小节生成单独的选项卡

如何 suppress 条形图中的零条?

我正在try 在R Studio中制作一张世界 map ,该 map 使用相对于数字变量的国家 colored颜色 填充

R:迭代推算\回补缺失值的函数

如何转置gtsum tbl_sum对象?