Try this: data.frame(row.names = unlist(a), gset_memberships(a))
On Mon, Mar 22, 2010 at 6:26 PM, Czerminski, Ryszard <ryszard.czermin...@astrazeneca.com> wrote: > I just started using nice package "sets" > and I wonder if there are utilities to convert (some) sets to data frame > (as in the example below) > >> library(sets) >> a <- gset(elements = list(e('A', 0.1), e('B', 0.8))) >> lst <- as.list(a) >> nr <- length(lst) >> rnames <- character() >> for (i in 1:nr) rnames[i] <- lst[[i]] >> df <- data.frame(row.names=rnames) >> df$memberships <- attr(lst, 'memberships') >> a > {"A" [0.1], "B" [0.8]} >> df > memberships > A 0.1 > B 0.8 >> > > Best regards, > Ryszard > --- > Ryszard Czerminski > > > -------------------------------------------------------------------------- > Confidentiality Notice: This message is private and may ...{{dropped:11}} > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ 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.