[R] Merge 2 columns into 1 column

David Winsemius dwinsemius at comcast.net
Sun Jan 20 03:09:40 CET 2013


On Jan 19, 2013, at 8:08 AM, qt2hot4u at gmail.com wrote:

> Hey everyone,
> 
> I just can’t wrap my head around this problem: I got 2 Columns with 4 columns.

OK, this is simply incoherent.


> They basically look like this:
> 1 2 3 4
> … … … …
> 
> I want to merge the two CSVs into a two-column list, which should look like this:
> 1 & 3 2 & 4
> … …
> … …
> 
> This is what I came up with so far:
> files <- paste(list.files(files.dir, pattern = "*.csv"), sep = "")# Scan
> mergedfiles <- do.call("rbind", lapply(files, read.csv)) # Merge
> 
> Obviously this will only merge the two CSVs into a four column list.

I doubt that claim. Can you provide a reproducible example to prove me wrong?


> Is there any way to merge columns 1 & 3 and columns 2 & 4 of both files into a single list?
> 
> Thanks and all the best
> Kenji
> 
> 
> 
> 	[[alternative HTML version deleted]]

-- 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list