0
私はリストとヌルデータフレーム(api fun!)の醜いリストを持っています。私が欲しいのは、name
要素のベクトルです。この場合、ベクトルは長さが13で、NAsではdata frame with 0 columns and 0 rows
となります。リストと空のデータフレームのリストから要素を抽出
myList <- list(structure(list(uuid = "x1",
name = "thanks"), .Names = c("uuid", "name"), class = "data.frame", row.names = 1L),
structure(list(uuid = "x2",
name = "team"), .Names = c("uuid", "name"), class = "data.frame", row.names = 1L),
structure(list(), .Names = character(0), row.names = integer(0), class = "data.frame"),
structure(list(uuid = "x3",
name = "team"), .Names = c("uuid", "name"), class = "data.frame", row.names = 1L),
structure(list(uuid = "x4",
name = "team"), .Names = c("uuid", "name"), class = "data.frame", row.names = 1L),
structure(list(uuid = "x5",
name = "enrolled"), .Names = c("uuid", "name"), class = "data.frame", row.names = 1L),
structure(list(uuid = "x6",
name = "team"), .Names = c("uuid", "name"), class = "data.frame", row.names = 1L),
structure(list(), .Names = character(0), row.names = integer(0), class = "data.frame"),
structure(list(uuid = "x7",
name = "team"), .Names = c("uuid", "name"), class = "data.frame", row.names = 1L),
structure(list(), .Names = character(0), row.names = integer(0), class = "data.frame"),
structure(list(uuid = "x8",
name = "team"), .Names = c("uuid", "name"), class = "data.frame", row.names = 1L),
structure(list(uuid = "x9",
name = "team"), .Names = c("uuid", "name"), class = "data.frame", row.names = 1L),
structure(list(uuid = "x10",
name = "team"), .Names = c("uuid", "name"), class = "data.frame", row.names = 1L))
所望の出力:
"thanks" "team" NA "team" "team" "enrolled" "team" NA "team" NA "team" "team" "team"
'非公開に(lapply(はmyList、機能(a)からc($名、NA)[1 + is.null($ name)])) ' –