RE: [R] beginner programming question

2003-12-22 Thread Adrian Dusa
] 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

Re: [R] beginner programming question

2003-12-18 Thread Thomas Lumley
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 -

RE: [R] beginner programming question

2003-12-17 Thread Gabor Grothendieck
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(

RE: [R] beginner programming question

2003-12-17 Thread Ray Brownrigg
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

RE: [R] beginner programming question

2003-12-17 Thread Gabor Grothendieck
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

Re: [R] beginner programming question

2003-12-17 Thread Tony Plate
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

Re: [R] beginner programming question

2003-12-17 Thread Peter Dalgaard
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

Re: [R] beginner programming question

2003-12-17 Thread Tony Plate
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 -