e the construct
a <- a+b
b <- a-b
a <- a-b
HTH
Peter Alspach
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Laura
> Rodriguez Murillo
> Sent: Wednesday, 24 February 2010 11:28 a.m.
> To: r
Try this:
a <- b <- read.table(textConnection("
1 + name1 1 2 3
2 + name2 5 9 10
2 - name3 56 74 93
1 - name4 65 75 98"), skip=1, header=FALSE)
swapidx <- with(a, (V1 == 2 & V2 == "+") | (V1 == 1 & V2 == "-"))
b[swapidx,] <- b[swapidx, c(1:3,6:4)]
This creates an indexing vector that identifies
On Feb 23, 2010, at 4:27 PM, Laura Rodriguez Murillo wrote:
Hi all,
I'd appreciate if anyone can help me with this...
I have a data frame that looks like this:
1 + name1 1 2 3
2 + name2 5 9 10
2 - name3 56 74 93
1 - name4 65 75 98
I need to rearrange this in a way so that the rows with "1"
Hi all,
I'd appreciate if anyone can help me with this...
I have a data frame that looks like this:
1 + name1 1 2 3
2 + name2 5 9 10
2 - name3 56 74 93
1 - name4 65 75 98
I need to rearrange this in a way so that the rows with "1" in the
first column, and "-" in the second column; then columns
4 matches
Mail list logo