[datatable-help] Data type unintentionally converting on data	tableon join
    Short, Tom 
    TShort at epri.com
       
    Wed Apr  6 14:48:21 CEST 2011
    
    
  
> -----Original Message-----
> From: datatable-help-bounces at r-forge.wu-wien.ac.at 
> [mailto:datatable-help-bounces at r-forge.wu-wien.ac.at] On 
> Behalf Of sant
> Sent: Wednesday, April 06, 2011 08:17
> To: datatable-help at r-forge.wu-wien.ac.at
> Subject: [datatable-help] Data type unintentionally 
> converting on data tableon join
> 
> Hello all,
> 
> Sorry if this is obvious but once of my variable(datetime) is 
> automatically changing with a join operation. I am not sure 
> if this expected and I don't want that to happen I have three 
> datasets the dputs are given at the end of the mail.
> 
> The problem I am facing is shown as follows (pls help):
> 
> #d1$datetime is num here
> str(d1)
> 
> #Doing a join
> tmp <- J(d1,d2,d3)
That's not what J is for. If you just want to rbind columns, do this:
data.table(d1, d2, d3)
If you want true joins, do something like this:
setkey(d1, Id)
setkey(d2, Id)
merge(d1, d2)
Or to merge individual entities, do:
d1$price <- d2[d1, price]
- Tom
    
    
More information about the datatable-help
mailing list