]
Sent: Thursday, December 18, 2003 5:53 PM
To: Tony Plate
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [R] beginner programming question
On Wed, 17 Dec 2003, Tony Plate wrote:
Another way to approach this is to first massage the data into a more
regular format. This may or may
On Wed, 17 Dec 2003, Tony Plate wrote:
Another way to approach this is to first massage the data into a more
regular format. This may or may not be simpler or faster than other
solutions suggested.
You could also use the reshape() command to do the massaging
-thomas
x -
Define function f to take a vector as input representing
a single input row. f should (1) transform this to a vector
representing the required row of output or else (2) produce
NULL if no row is to be output for that input row.
Then use this code where z is your input matrix:
t( matrix(
From: Gabor Grothendieck [EMAIL PROTECTED]
Date: Wed, 17 Dec 2003 15:02:49 -0500 (EST)
Define function f to take a vector as input representing
a single input row. f should (1) transform this to a vector
representing the required row of output or else (2) produce
NULL if no row is to
the first two advantages listed.
---
Date: Thu, 18 Dec 2003 10:04:52 +1300 (NZDT)
From: Ray Brownrigg [EMAIL PROTECTED]
To: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [R] beginner programming question
From: Gabor Grothendieck [EMAIL PROTECTED]
Date: Wed, 17 Dec
Another way to approach this is to first massage the data into a more
regular format. This may or may not be simpler or faster than other
solutions suggested.
x - read.table(clipboard, header=T)
x
rel1 rel2 rel3 age0 age1 age2 age3 sex0 sex1 sex2 sex3
113 NA 25 232 NA
Tony Plate [EMAIL PROTECTED] writes:
xx - rbind(colnames-(x[,c(rel1,age0,age1,sex0,sex1)], nn),
+ colnames-(x[,c(rel2,age0,age2,sex0,sex2)], nn),
+ colnames-(x[,c(rel3,age0,age3,sex0,sex3)], nn))
PS. To advanced R users: Is the above usage of the colnames-
function within an
Thanks. As a follow-up question, is it considered acceptable programming
practice for - functions to modify their x argument?
-- Tony Plate
At Thursday 12:23 AM 12/18/2003 +0100, Peter Dalgaard wrote:
Tony Plate [EMAIL PROTECTED] writes:
xx -