[R] problems with reading the data and merge

kayj kjaja27 at yahoo.com
Fri Jun 6 01:58:43 CEST 2008


I have a problem with reading a file data.txt that has a header 
Each row has the individual ID and then some data  that are letter and
numbers such as 00
If I read the file as 

  data<-read.table("data.txt",sep='\t', header=T)
  write.table(data,file="data1.txt", sep='\t', quote=F, col.names=T,
row.names=F)

data1.txt looks different than data.txt. In data1.txt some of the 00 entries
are replaced with just a 0!

But If I read the file as 
data<-read.table("data.txt",sep='\t', header=F)
write.table(data,file="data2.txt", sep='\t', quote=F, col.names=F,
row.names=F)

Then data2.txt looks exactly like data.txt (no problem)

My problem is when I need to merge data with another data set for example
data3,
How can I telll R to merge them If I  specify the header=F, 
I tried 

M<-merge(data, data3, by”V1”)  This does not work.

What is the problem? I hope someone can help


-- 
View this message in context: http://www.nabble.com/problems-with-reading-the-data-and-merge-tp17682040p17682040.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list