Hi,
I have a list that looks like below. I want to put the tmp2[[ x ]]$value in the first column, and then put all the 11 items in tmp2[[ x ]]$data into its own columns. So in total, I should have 12 columns. I am not sure how to start with this even. Any help would be really appreciated. Thanks.
sample object below:
tmp2 <- list(list(itemId = "11910220000", value = "00:00 2019-11-22",
data = list(3046.2, 3046.2, 658.74, 572.12, 692.02, 647.21,
183.25, 189.87, 60, 0, 17.99)), list(itemId = "11910220001",
value = "00:01 2019-11-22", data = list(2990.6, 2990.6, 521.92,
738.19, 351.78, 538.99, 622.12, 192.6, 25, 0, 0)), list(
itemId = "11910220002", value = "00:02 2019-11-22", data = list(
2659.23, 2659.23, 693.09, 492.97, 635.4, 203.96, 432.98,
116.46, 84.37, 0, 0)))
I tried
tmp3 <- tmp2 %>%
map_df(extract,"value")
This gives me a dataframe with a single column with all the values from tmp[[ x ]]$value
When I try
tmp3 <- tmp2 %>%
map_df(extract,"data")
I get all the values of data in a single column.
Ideal result would give me a single row for each value with it in the first column, then it's data attribute to be in the other 10 columns.