[R] Adding two files into one and vlookup
raghu
r.raghuraman at gmail.com
Wed Jul 7 00:18:16 CEST 2010
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 I write
a vlookup kind of function? I am giving an example below:
Say Price1 file contains the following:
Date Price
2/3/2010 134.00
3/3/2010 133.90
4/3/2010 135.55
And say price2 contains the following:
Date Price
2/3/2010 2300
3/3/2010 3200
4/3/2010 1800
5/3/2010 1900
I want to take both these data together in a single file, and take the
smaller vector (or matrix or dataframe??..i am new to R and still confused
with the various objects) which is file1 (because it contains fewer rows )
and vlookup prices in the second file basedon the dates on file1 and write
three columns (date, price from 1 and price from2) in a new file. How do i
do this please?
Many thanks...
R
--
View this message in context: http://r.789695.n4.nabble.com/Adding-two-files-into-one-and-vlookup-tp2280277p2280277.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list