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.

Reply via email to