Re: [R] Data frame with 3 columns to matrix

2011-04-19 Thread Michael Bach
David Winsemius writes: > On Apr 19, 2011, at 8:16 AM, Michael Bach wrote: > >> David Winsemius writes: >> >>> Perhaps but only if the third row of your example was incorrectly >>> constructed: dta <- rd.txt(" x y z >>> 1 1.00 5 0.5 >>> 2 1.02 5 0.7 >>> 3 1.04 7 0.1 >>> 4 1.06 9 0.4")

Re: [R] Data frame with 3 columns to matrix

2011-04-19 Thread David Winsemius
On Apr 19, 2011, at 8:16 AM, Michael Bach wrote: David Winsemius writes: Perhaps but only if the third row of your example was incorrectly constructed: dta <- rd.txt(" x y z 1 1.00 5 0.5 2 1.02 5 0.7 3 1.04 7 0.1 4 1.06 9 0.4") #rd.txt() is a combo fn of read.table and textConnection

Re: [R] Data frame with 3 columns to matrix

2011-04-19 Thread Michael Bach
David Winsemius writes: > Perhaps but only if the third row of your example was incorrectly constructed: >> dta <- rd.txt(" x y z > 1 1.00 5 0.5 > 2 1.02 5 0.7 > 3 1.04 7 0.1 > 4 1.06 9 0.4") > #rd.txt() is a combo fn of read.table and textConnection > >> mat <- matrix(NA, ncol=NROW(dta)+1,

Re: [R] Data frame with 3 columns to matrix

2011-04-19 Thread David Winsemius
On Apr 19, 2011, at 3:46 AM, Michael Bach wrote: Dear R Users, Lets assume I have this data frame: x y z 1 1.00 5 0.5 2 1.02 5 0.7 3 1.04 7 0.1 4 1.06 9 0.4 x and y columns are sorted and the values not necessarily integers. z values are not sorted. Now I would like to create a matri