How to merge 2 files with R
dat <- read.table("PLMLMeditGenepop.txt")
head(dat)
dat2 <- read.table("CoordMedit.txt")
head(dat2)
# Fusion des tables
dfr2 <- cbind.data.frame(dat2, dat)
head(dfr2)
write.table(dfr, "LnPD.txt", sep=" ", row.names=F, quote=F)
# Classer par longitude
dfr3<-dfr2[ order(dfr2$V2), ]
head(dfr3)
dfr4 <- dfr3[,-1:-2]
dfr4
write.table(dfr4, "genpopMeditFinal.txt", sep=" ", row.names=F, quote=F)
dfr5 <- dfr4[,!colnames(dfr4)=="nb"]
head(dfr5)
dat <- read.table("table.txt")
head(dat)
write.table(dat, "table.csv", sep=";", row.names=F, quote=F)