Re: [R] Bug in Merge?

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Sat, 19 Apr 2008 00:28:01 +0200

Edwin Sendjaja wrote:
> Hello,
>
>
> I find strange number in my merge data set.
>
> My first coloumn consist row numbers.
>
> -----------------------------------------------------------
> my.data:
>
>
> AbsTime RelTime PE_ID Event Delay
>
> 4238 1208514343.812086 107.153637 4 EKA 51620
>
> ##################################
> Host.data:
>
>
> ID Host
>
> 4 4 vicky.planetlab.ntua.gr
>
> ------------------------------------------------------------
>
> data<-read.table("my.data")
> mapping<-read.table("Host.data")
>
> mergeXY <- merge(data,mapping, by.x="PE_ID", by.y="ID")
>
>
> If I merge these data then i get:
>
> "PE_ID" "AbsTime" "RelTime" "Ereignis" "Delay" "Host"
> "2" 4 1208514343.81209 107.153637 "EndpointKeepAlive" "
> 51620 "vicky.planetlab.ntua.gr"
>
>
> -------------------------------------------------------
>
> The first problem:
>
> Why is the row number "2" now? Where does this nummber come from?
>
>
I don't know. Where did "Ereignis" and "EndpointKeepAlive" come from????

That is, you are paraphrasing your results instead of giving us a reproducible example to go on!

(And I can't reproduce it. I get a rowname of 1, whatever I try.)  

> I think, there is a conflict between my row number from data and mapping (4238
> and 4).
>
> The second problem:
>
> Why is my AbsTime: 1208514343.81209? It was 1208514343.812086. It is 1 digit
> less. how can I avoid this?
>
>
You're running out of floating point precision (the rel. error is about 1e-16). Either user fewer digits (e.g. move the origin of time 1208500000 units forward) or don't represent as floating point. Using colClasses, you can read it as a character variable and take it from there. One idea is to represent the integer and fractional parts separately.

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 18 Apr 2008 - 22:32:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Apr 2008 - 23:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive