Is this what you want: > x V1 V2 1 row1 2334 2 row2 347 3 row3 379 > x.list <- as.list(x$V2) > names(x.list) <- x$V1 > x.list $row1 [1] 2334
$row2 [1] 347 $row3 [1] 379 On Mon, Sep 6, 2010 at 7:55 AM, Viki S <is...@live.com> wrote: > > Hi Friends, > I am new to R. > > On R utility class pages, creating "named.list" is described with this > command : > new("named.list",a=1,b=2) > > > For large matrix having two columns, such as : > > "row1" 2334 > "row2" 347 > "row3" 379 > ... > > I want to create a named.list like : > $row1 > [1] 2334 > > $row2 > [1] 347 > > ... > > Can anyone explain how "named.list" variable can be created by using two > specified columns of a dataframe or matrix object, where one of the two > columns is assigned as a name (string) and > other as its corresponding value ? > > Thanks > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.