#let's suppose I have a list like this

mytest<-list(45, NULL, 18, NULL, 99)

#to note that this is just an amended example because in fact

#I'm dealing with a long list (more than 400 elements)

#with no evident pattern of the NULL values

#I want to end up with a data frame like the following

data.frame(i=c(1,3,5), n=c(45,18,99))

#i.e. a data frame storing in

#column i the number of corresponding element list

#column n the unique component of that element

#I've been trying with

do.call(rbind, mytest)

#or

do.call(rbind.data.frame, mytest)

#but this approach is not properly achieving the desired result

#now I'm in trouble on how to store each element number of the list in 
the first column data frame

#any help for this?

#thanks


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to