On Sep 2, 2011, at 9:30 AM, David Winsemius wrote:
On Sep 2, 2011, at 8:34 AM, Joao Fadista wrote:
Dear all,
I would like to know how to merge columns like:
Input file:
V1 V2 V3 V4 V5 V6
1 G A G G G G
2 A A G A A G
Looked like an mapply-type problem:
> with(dat,
mapply
On Sep 2, 2011, at 8:34 AM, Joao Fadista wrote:
Dear all,
I would like to know how to merge columns like:
Input file:
V1 V2 V3 V4 V5 V6
1 G A G G G G
2 A A G A A G
Looked like an mapply-type problem:
> with(dat,
mapply(paste,
list(V1, V3, V5),
Hi:
Here's one approach:
d <- read.table(textConnection("
V1 V2 V3 V4 V5 V6
1 G A G G G G
2 A A G A A G"), header = TRUE, stringsAsFactors = FALSE)
closeAllConnections()
# Create two vectors of variable names, one for odd numbered,
# one for even numbered
vars1 <- names(d)[seq_along(
Dear all,
I would like to know how to merge columns like:
Input file:
V1 V2 V3 V4 V5 V6
1 G A G G G G
2 A A G A A G
Desired output file:
V1 V2 V3
1 G/A G/G G/G
2 A/A G/A A/G
So for every 2 consecutive columns merge their content into one.
Thanks in advance.
[[al
4 matches
Mail list logo