Re: [R] Elements of Sets as dataframe column names

2018-03-20 Thread Jim Lemon
Hi Neha, >From your message I think that you might get what you want with: names(df)<-unlist(B) However, the "sets" package might handle lists differently. Jim On Tue, Mar 20, 2018 at 2:24 PM, Neha Aggarwal wrote: > Hello all, > > I have a set B and a dataframe df. I want to name the columns o

Re: [R] Elements of Sets as dataframe column names

2018-03-19 Thread Bert Gunter
You have failed to tell us that you are using a package, presumably the sets package. What I believe you don't understand is that the underlying data structures that represent sets are not what you think they are, but behave as you expect through the package API. So unless the API gets you the nam

[R] Elements of Sets as dataframe column names

2018-03-19 Thread Neha Aggarwal
Hello all, I have a set B and a dataframe df. I want to name the columns of the dataframe after the elements of the set B. For example, for set B with elements {{"P1"}, {"P2"}, {"P3", "P4"}} I want to create a new dataframe with 3 columns named {"P1"} and {"P2"} and {"P3","P4"}. I tried colnames