[R] Dates in a data.frame
Francesca
francesca.pancotto at gmail.com
Mon Nov 17 12:49:47 CET 2014
>
Dear Contributors
I have a problem concerning the replication of a variable with
the date structure.
I have the following database of 12000 observations
bank.list.m:
name date
aba.1 ABA 2006-10-24
aba.2 ABA 2006-11-30
aba.3 ABA 2006-10-24
aba.4 ABA 2006-11-30
aba.5 ABA 2006-10-24
aba.6 ABA 2006-11-30
aba.7 ABA 2006-10-24
aba.8 ABA 2006-11-30
aba.9 ABA 2006-10-24
aba.10 ABA 2006-11-30
and the following with 960 obs.
day.spot
date spot
1 2006-01-02 1.1826
2 2006-01-03 1.1875
3 2006-01-04 1.2083
4 2006-01-05 1.2088
5 2006-01-06 1.2093
6 2006-01-09 1.2078
the date in the second database are a subset of the dates of the first
database.
What I need to do is to associate the value of the variable spot
reported in the second database, at the exact place of the corresponding
date in the first database.
I tried the following
dates<-table(bank.list.m$date)
test<-as.data.frame(dates)
dates.v<-as.Date(test$Var1)
x<-as.data.frame(dates.v)
x$index<-c(1:960)
x$spot.v<-day.spot$spot[x$index]
but I do not seem to go anywhere.
I think I only replicated the values of the day.spot variable.
Any help?
Thanks for your time and patience!
Francescaa
--
Francesca
----------------------------------
Francesca Pancotto, PhD
Università di Modena e Reggio Emilia
Viale A. Allegri, 9
40121 Reggio Emilia
Office: +39 0522 523264
Web: https://sites.google.com/site/francescapancotto/
----------------------------------
[[alternative HTML version deleted]]
More information about the R-help
mailing list