[Rd] bug (and fix) in seq.POSIXt (PR#1046)

dmiddleton@fisheries.gov.fk dmiddleton@fisheries.gov.fk
Thu, 9 Aug 2001 22:32:00 +0200 (MET DST)


I can't reach r-project.org at the moment so cannot check whether this
is a known bug.

> version
         _              
platform i386-pc-mingw32
arch     x86            
os       Win32          
system   x86, Win32     
status                  
major    1              
minor    3.0            
year     2001           
month    06             
day      22             
language R


The help page for seq.POSIXt states that the "by" argument can be
specified in several ways, including "A character string, containing one
of "sec", "min", "hour", "day", "week", "month" or "year". This can
optionally be preceded by an integer and a space".  I have found that
preceding the character string by an integer and space only works for
months and years.

The solution (or my solution at any rate) is to change 

        if (valid <= 5) 
            by <- c(1, 60, 3600, 86400, 7 * 86400)[valid]

to

        if (valid <= 5) {
            by <- c(1, 60, 3600, 86400, 7 * 86400)[valid]
	    if (length(by2) == 2) by <- by * as.integer(by2[1])
	}

in the seq.POSIXt code.

Thanks to those who worked to add the DateTimeClasses.  I have only
started making use of these recently, but am finding them very useful.

David Middleton

Dr David A. J. Middleton, Stock Assessment Scientist
Fisheries Department, Falkland Islands Government
Stanley, Falkland Islands
Tel: +500 27260  Fax +500 27265  Email: dmiddleton@fisheries.gov.fk
Web: http://www.falklandislands.com/business/fisheries.htm


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._