Skip to content

bug in ifelse (PR#6611)

2 messages · Svetlana Eden, Brian Ripley

#
_
platform i386-pc-linux-gnu
arch     i386
os       linux-gnu
system   i386, linux-gnu
status
major    1
minor    8.1
year     2003
month    11
day      21
language R
Error in rep.int(unclass(x), times) : Argument "times" is missing, with
no default
submitted by Frank E Harrel Jr
#
This is already corrected in the current R-devel sources.

Note that this is an incorrect use of as.POSIXct: do read the 
description of the allowed formats:

     They can also
     convert character strings of the formats '"2001-02-03"' and
     '"2001/02/03"' optionally followed by white space and a time in
     the format '"14:52"' or '"14:52:03"'.  (Formats such as
     '"01/02/03"' are ambiguous but can be converted via a format
     specification by 'strptime'.)

and you are not getting the result I think you expected.

Finally, the result is not of class "POSIXct", which looks like an 
infelicity in ifelse.

aa <- as.POSIXct(c('1980/1/1','1980/1/2',''))
aaa <- aa
aaa[is.na(aa)] <-  as.POSIXct('1980/1/3') 

is probably what you wanted here.
On Tue, 24 Feb 2004 svetlana.eden@vanderbilt.edu wrote: