# Creating multiple vector/list names-novice

6 messages
Open this post in threaded view
|

## Creating multiple vector/list names-novice

 Hi I have very simple issue as I am still new to the group of R I have basically vector of names for which i want to create mutliple combinations and then place them in different vectors. In some other language I can just place a third dimension to separate list (or matrix) but i do not know how to do it in R. My issue is simple I use cc<-combn(colnames(DD),2) I would need to have this as vector1 or like vector[,,1] :           cc<-combn(colnames(DD),2) vector2or like vector[,,2]              cc<-combn(colnames(DD),3) etc..for up to k combinations something so then I can use for loop to go through the al of these combinations example: string<-"a", "b" , "c" ",d" vector/list(1) ab ac ad bc bd be cd ce de vector/list  (2) abc abd abe bcd bce bde cde Can you help me with this.. I know that it is a simple question for this thread thank you.. Michal
Open this post in threaded view
|

## Re: Creating multiple vector/list names-novice

 Try this:  lapply(2:3, FUN = combn, x = string, paste, collapse = '') On Mon, Apr 4, 2011 at 11:24 AM, michalseneca <[hidden email]> wrote: > Hi I have very simple issue as I am still new to the group of R > > I have basically > > vector of names for which i want to create mutliple combinations and then > place them in different vectors. In some other language I can just place a > third dimension to separate list (or matrix) but i do not know how to do it > in R. > > My issue is simple I use > cc<-combn(colnames(DD),2) > > I would need to have this as > > vector1 or like vector[,,1] :           cc<-combn(colnames(DD),2) > vector2or like vector[,,2]              cc<-combn(colnames(DD),3) > > etc..for up to k combinations > > something so then I can use for loop to go through the al of these > combinations > > example: > > string<-"a", "b" , "c" ",d" > > vector/list(1) ab ac ad bc bd be cd ce de > vector/list  (2) abc abd abe bcd bce bde cde > > > Can you help me with this.. I know that it is a simple question for this > thread thank you.. > > Michal > > > -- > View this message in context: http://r.789695.n4.nabble.com/Creating-multiple-vector-list-names-novice-tp3425616p3425616.html> Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: Creating multiple vector/list names-novice

 Hi Thanks ,however I would need something different still... I would need  to return a vector so if as  to choose cc[[3]] [2] would return vector/list  as in terms of  c(b,d,e) Thanks
Open this post in threaded view
|

## Re: Creating multiple vector/list names-novice

 The exact would be for example that I shoul be able then to choose "a" from "abc". and I cannot do that.
Open this post in threaded view
|

## Re: Creating multiple vector/list names-novice

 On 05.04.2011 09:07, michalseneca wrote: > The exact would be for example that I shoul be able then to choose "a" from > "abc". and I cannot do that. The is rather unhelpful for helpers without quoting what your original question and the answers were. Uwe Ligges > -- > View this message in context: http://r.789695.n4.nabble.com/Creating-multiple-vector-list-names-novice-tp3425616p3427283.html> Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: Creating multiple vector/list names-novice

 Thanks I already found out solution :)