[R-sig-Geo] merge 2 txt file

Ashton Shortridge ashton at msu.edu
Wed Nov 5 19:14:34 CET 2008


Hi Ale,

When you say merge, do you mean you want to append one onto the other, or you 
really want to merge elements that have common x and y values?

If it's the first case, then I'd probably read both in with read.table() and 
then rbind them:
dat1 <- read.table("file1.txt")
dat2 <- read.table("file2.txt")
dat3 <- rbind(dat1,dat2)

If it's the second, I can't help much. Did you try it? Did that work? If you 
can't tell (if, say, the text files are really big) then make two small test 
files and try that.

Ashton

On Tuesday 04 November 2008 06:52:20 pm Alessandro wrote:
> Hi all,
>
>
>
> I have two txt file with X,Y,Z column and I need to merge together
>
>
>
> I tried
>
> file_all <- merge("file1.txt","file2.txt")
>
> but I don't sure about the result. Is It this code correct?
>
> Thanks Ale
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 
Ashton Shortridge
Associate Professor			ashton at msu.edu
Dept of Geography			http://www.msu.edu/~ashton
235 Geography Building		ph (517) 432-3561
Michigan State University		fx (517) 432-1671




More information about the R-sig-Geo mailing list