Reading list entries in R -
i have got list 12 entries.
[[1]] event_id time_occurred [1,] "mx050113" "2013-03-29 05:45:03" [2,] "mx050112" "2013-03-29 05:43:03" [3,] "mx050113" "2013-03-29 05:42:03" [4,] "mx050110" "2013-03-29 05:41:03" [5,] "mx050513" "2013-03-29 05:39:03" [6,] "mx050113" "2013-03-29 05:38:03"` [[2]] event_id time_occurred [1,] "mx050117" "2013-03-29 06:47:03" [2,] "mx050122" "2013-03-29 06:44:03" [3,] "mx050213" "2013-03-29 06:42:03" [4,] "mx050160" "2013-03-29 06:40:03" [5,] "mx020513" "2013-03-29 06:38:03"` [[3]] . . . [[12]]
now in [[1]]..[[12]], how read data under header == time_occurred position [1,2] in [[1]]? can't give r code list please suggest me syntax query.
you have bunch of matrices, , want extract second column in each. use lapply
:
lapply(lst, function(x) x[, 2])
Comments
Post a Comment