Amar jaiswal Amar jaiswal -4 years ago 37
R Question

Store output of sapply into a data frame?

how can I store the output of

sapply()
to a dataframe where the index value is stored in first column and its value in corresponding 2nd column.

mylist <- sapply()
mylist
df
1
rf
2


I want output as:

var value
df 1
rf 2

Answer Source

We can use stack

stack(mylist)[2:1]

data

mylist <- list(df = 1, rf = 2)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download