[R] Help with Dates
Jeffrey J. Hallman
jhallman at frb.gov
Thu Jul 26 17:39:41 CEST 2007
Are you using the latest version of fame? 1.05 and earlier had a bug in
tisFromCsv that was fixed in 1.08.
Below I show what I get with fame version 1.08. There is still a problem in
that the "frequency-figuring" logic appears to think the frequency is bwsunday
(biweekly with weeks ending on Sunday) rather than semimonthly, which would
appear to be a better fit. That's why the 19860330 observation is getting
filled in with NA's.
Jeff
> Lines <- "Date Price Open.Int. Comm.Long Comm.Short net.comm
15-Jan-86 673.25 175645 65910 28425 37485
31-Jan-86 677.00 167350 54060 27120 26940
14-Feb-86 680.25 157985 37955 25425 12530
28-Feb-86 691.75 162775 49760 16030 33730
14-Mar-86 706.50 163495 54120 27995 26125
31-Mar-86 709.75 164120 54715 30390 24325"
+ + + + + + >
> boink <- tisFromCsv(textConnection(Lines), dateFormat = "%d-%b-%y", dateCol = "Date", sep = "")
> boink
$Price
[,1]
19860119 673.25
19860202 677.00
19860216 680.25
19860302 691.75
19860316 706.50
19860330 NA
19860413 709.75
class: tis
$Open.Int.
[,1]
19860119 175645
19860202 167350
19860216 157985
19860302 162775
19860316 163495
19860330 NA
19860413 164120
class: tis
$Comm.Long
[,1]
19860119 65910
19860202 54060
19860216 37955
19860302 49760
19860316 54120
19860330 NA
19860413 54715
class: tis
$Comm.Short
[,1]
19860119 28425
19860202 27120
19860216 25425
19860302 16030
19860316 27995
19860330 NA
19860413 30390
class: tis
$net.comm
[,1]
19860119 37485
19860202 26940
19860216 12530
19860302 33730
19860316 26125
19860330 NA
19860413 24325
class: tis
"Gabor Grothendieck" <ggrothendieck at gmail.com> writes:
> On 26 Jul 2007 09:59:31 -0400, Jeffrey J. Hallman <jhallman at frb.gov> wrote:
> > zoo is nice. 'tisFromCsv()' in the fame package is nicer.
> >
> > Jeff
>
>
> 1. What am I doing wrong here? I only get one data column.
> 2. I assume the regularized dates which do not exactly match the input ones
> are intended so as to make this a regularly spaced series. Is that right?
> 3. What is the cause of the warning message?
> 4. Why is a list returned with a single component containing the output?
> Thanks.
>
> > library(fame)
> > Lines <- " Date Price Open.Int. Comm.Long Comm.Short net.comm
> + 15-Jan-86 673.25 175645 65910 28425 37485
> + 31-Jan-86 677.00 167350 54060 27120 26940
> + 14-Feb-86 680.25 157985 37955 25425 12530
> + 28-Feb-86 691.75 162775 49760 16030 33730
> + 14-Mar-86 706.50 163495 54120 27995 26125
> + 31-Mar-86 709.75 164120 54715 30390 24325
> + "
> > tisFromCsv(textConnection(Lines), dateFormat = "%d-%b-%y", dateCol = "Date", sep = "")
> [[1]]
> [,1]
> 19860119 673.25
> 19860202 677.00
> 19860216 680.25
> 19860302 691.75
> 19860316 706.50
> 19860330 709.75
> class: tis
>
> Warning message:
> number of items to replace is not a multiple of replacement length in:
> x[i] <- value
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
--
Jeff
More information about the R-help
mailing list