[R] Conditionally swap two columns of a data.frame?

2004-09-16 Thread Dan Bolser
I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size ratio between the two. i.e. plot(density(data$V1/data$V2)) This kinda gives me a normal curve showing

Re: [R] Conditionally swap two columns of a data.frame?

2004-09-16 Thread Dimitris Rizopoulos
: Thursday, September 16, 2004 2:19 PM Subject: [R] Conditionally swap two columns of a data.frame? I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size ratio

Re: [R] Conditionally swap two columns of a data.frame?

2004-09-16 Thread Prof Brian Ripley
On Thu, 16 Sep 2004, Dan Bolser wrote: I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size ratio between the two. i.e. plot(density(data$V1/data$V2))

Re: [R] Conditionally swap two columns of a data.frame?

2004-09-16 Thread Dan Bolser
://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Dan Bolser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:19 PM Subject: [R] Conditionally swap two columns of a data.frame? I am doing this a kinda dumb way

RE: [R] Conditionally swap two columns of a data.frame?

2004-09-16 Thread Andy Bunn
ifelse accomplishes this pretty easily (at least I think it does what you want) Look at ?apply too. HTH, Andy ## Try this foo.dat - data.frame(Var1 = rnorm(4, 1, 1), Var2 = (rnorm(4, 1, 1) * 0.25)) plot(density(foo.dat$Var1 / foo.dat$Var2)) RatioOne -

Re: [R] Conditionally swap two columns of a data.frame?

2004-09-16 Thread Dimitris Rizopoulos
] To: Dimitris Rizopoulos [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:55 PM Subject: Re: [R] Conditionally swap two columns of a data.frame? Minter! Is there an R cookbook? which lists this kind of common problem and common solution? On Thu, 16 Sep 2004, Dimitris

Re: [R] Conditionally swap two columns of a data.frame?

2004-09-16 Thread Dan Bolser
://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Dan Bolser [EMAIL PROTECTED] To: Dimitris Rizopoulos [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:55 PM Subject: Re: [R] Conditionally swap two columns of a data.frame? Minter! Is there an R

Re: [R] Conditionally swap two columns of a data.frame?

2004-09-16 Thread Paul Lemmens
Hoi Dan, --On donderdag 16 september 2004 13:55 +0100 Dan Bolser [EMAIL PROTECTED] wrote: Is there an R cookbook? Yes there is (sort of): StatsRus http://www.ku.edu/~pauljohn/R/Rtips.html kind regards, Paul -- Paul Lemmens NICI, University of Nijmegen ASCII Ribbon Campaign /\

Re: [R] Conditionally swap two columns of a data.frame?

2004-09-16 Thread Wolski
PROTECTED] Sent: Thursday, September 16, 2004 2:19 PM Subject: [R] Conditionally swap two columns of a data.frame? I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size