Re: [R] Adding two files into one and vlookup

2010-07-08 Thread Dennis Murphy
Hi: > merge(file2, file1, by = 'Date') DatePrice.x Price.y 1 03/07/2010 5.312006 56.92826 2 04/07/2010 673.070592 39.27409 3 05/07/2010 442.467939 42.59834 4 06/07/2010 851.915899 70.68512 5 07/07/2010 581.859242 10.92505 HTH, Dennis On Wed, Jul 7, 2010 at 8:07 AM, Raghu wrote:

Re: [R] Adding two files into one and vlookup

2010-07-08 Thread Petr PIKAL
Hi see ?merge Regards Petr r-help-boun...@r-project.org napsal dne 07.07.2010 17:07:34: > Say I have two files file and file2: > > file1 contains the following: > Date Price > 02/07/2010 53.96597903 > 03/07/2010 56.92825807 > 04/07/2010 39.27408645 > 05/07/2010 42.

Re: [R] Adding two files into one and vlookup

2010-07-07 Thread Raghu
Say I have two files file and file2: file1 contains the following: DatePrice 02/07/2010 53.96597903 03/07/2010 56.92825807 04/07/2010 39.27408645 05/07/2010 42.59834151 06/07/2010 70.68512383 07/07/2010 10.92505265 08/07/2010 52.12492249 09/07

Re: [R] Adding two files into one and vlookup

2010-07-07 Thread raghu
I tried and this error popped: z1 <- read.zoo(textConnection(Lines1), header = TRUE, format = fmt) Error in textConnection(Lines1) : invalid 'text' argument Also library(chron) returns error as it is an invalid library. Could you help? On 7/7/10, Gabor Grothendieck [via R] wrote: > > > > On Tue

Re: [R] Adding two files into one and vlookup

2010-07-07 Thread Raghu
I was able to achieve the desired output. The issue I had was that both the files contained the Date column in the data format. So, i first converted this colum alone into numeric and then did a merge on the files and it worked. The moral is that in any dataframe all variable have to be of similar

Re: [R] Adding two files into one and vlookup

2010-07-07 Thread raghu
ssage- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- >> project.org] On Behalf Of raghu >> Sent: Wednesday, 7 July 2010 10:18 a.m. >> To: r-help@r-project.org >> Subject: [R] Adding two files into one and vlookup >> >> >> I have

Re: [R] Adding two files into one and vlookup

2010-07-06 Thread Gabor Grothendieck
On Tue, Jul 6, 2010 at 8:26 PM, Gabor Grothendieck wrote: > On Tue, Jul 6, 2010 at 6:18 PM, raghu wrote: >> >> I have two files with dates and prices in each. The number of rows in each of >> them will differ. How do I create a new file which contains data from both >> these files? Cbind and merg

Re: [R] Adding two files into one and vlookup

2010-07-06 Thread Gabor Grothendieck
On Tue, Jul 6, 2010 at 6:18 PM, raghu wrote: > > I have two files with dates and prices in each. The number of rows in each of > them will differ. How do I create a new file which contains data from both > these files? Cbind and merge are not helpful. For cbind because the rows are > not the same

Re: [R] Adding two files into one and vlookup

2010-07-06 Thread Erik Iverson
raghu wrote: I have two files with dates and prices in each. The number of rows in each of them will differ. How do I create a new file which contains data from both these files? Cbind and merge are not helpful. For cbind because the rows are not the same replication occurs. Also if I have simila

Re: [R] Adding two files into one and vlookup

2010-07-06 Thread Peter Alspach
alf Of raghu > Sent: Wednesday, 7 July 2010 10:18 a.m. > To: r-help@r-project.org > Subject: [R] Adding two files into one and vlookup > > > I have two files with dates and prices in each. The number of rows in > each of > them will differ. How do I create a new file wh

[R] Adding two files into one and vlookup

2010-07-06 Thread raghu
I have two files with dates and prices in each. The number of rows in each of them will differ. How do I create a new file which contains data from both these files? Cbind and merge are not helpful. For cbind because the rows are not the same replication occurs. Also if I have similar data how do