Try this using the BOD data frame that comes with R or try using interaction in place of paste:
split(BOD, do.call(paste, c(BOD, sep = ":")), drop=TRUE) On Nov 25, 2007 10:23 AM, <[EMAIL PROTECTED]> wrote: > > > Thanks Jim and Herinque for you reply. > > The substitution you are both proposing works fine, except when a or b > contains > decimal numbers (which is mostly my case in a real dataset). In this case, > there > is no distinction between the decimal point and the one introduced by the > split > function. > If the split function cannot be customized, then I guess I have to first > substitute the decimal point in my dataset by e.g. a * sign and change it back > to a . when the split is done... > > Sebastien > > jim holtman a écrit : > > > Here is one way: > > > >> a<-1:10 > >> b<-21:30 > >> mydata<-data.frame(a,b) > >> mydata.split<-split(mydata,(mydata[,1:2]),drop=TRUE) > >> x <- mydata.split > >> # customize the names > >> names(x) <- sapply(strsplit(names(x), "\\."), paste, collapse="-my > character-") > >> x > > $`1-my character-21` > > a b > > 1 1 21 > > > > $`2-my character-22` > > a b > > 2 2 22 > > > > $`3-my character-23` > > a b > > 3 3 23 > > ........... > > > > On Nov 24, 2007 6:15 PM, <[EMAIL PROTECTED]> wrote: > >> > >> Dear R-users, > >> > >> The following code splits a very simple dataframe into a list, each element > of > >> the list being one line of the dataframe. You will see that the split > function > >> names each element of the list by using uses the content of a and b and > merging > >> them with a "." character. Is there a way to customize this character? > >> > >> a<-1:10 > >> b<-21:30 > >> mydata<-data.frame(a,b) > >> mydata.split<-split(mydata,(mydata[,1:2]),drop=TRUE) > >> mydata.split > >> > >> Thanks in advance for your help. > >> > >> Sebastien > >> > >> ______________________________________________ > >> 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. > >> > > > > > > > > ______________________________________________ > 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. > ______________________________________________ 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.