similar to: Date class shows Inf as NA; this confuses the use of is.na()

Displaying 20 results from an estimated 6000 matches similar to: "Date class shows Inf as NA; this confuses the use of is.na()"

2018 Jun 08
2
Date class shows Inf as NA; this confuses the use of is.na()
Indeed. as_date is from lubridate, but the same holds for as.Date. The output and it's interpretation should be consistent, otherwise it leads to confusion when programming. I understand that the difference exists after asking a question on Stack Overflow: https://stackoverflow.com/q/50766089/914686 This understanding is never mentioned in the documentation - that an Inf date is actually
2018 Jun 09
4
Date class shows Inf as NA; this confuses the use of is.na()
And now I've seen I copied the wrong part of ?is.na > The default method for is.na applied to an atomic vector returns a logical vector of the same length as its argument x, containing TRUE for those elements marked NA or, for numeric or complex vectors, NaN, and FALSE otherwise. Key point being "atomic vector" here. On Sat, Jun 9, 2018 at 1:41 PM, Joris Meys <jorismeys at
2018 Jun 11
2
Date class shows Inf as NA; this confuses the use of is.na()
Emil et al., On Mon, Jun 11, 2018 at 1:08 AM, Emil Bode <emil.bode at dans.knaw.nl> wrote: > I don't think there's much wrong with is.na(as_date(Inf, > origin='1970-01-01'))==FALSE, as there still is some "non-NA-ness" about > the value (as difftime shows), but that the output when printing is > confusing. The way cat is treating it is clearer: it
2018 Jun 11
0
Date class shows Inf as NA; this confuses the use of is.na()
I don't think there's much wrong with is.na(as_date(Inf, origin='1970-01-01'))==FALSE, as there still is some "non-NA-ness" about the value (as difftime shows), but that the output when printing is confusing. The way cat is treating it is clearer: it does print Inf. So would this be a solution? format.Date <- function (x, ...) { xx <- format(as.POSIXlt(x), ...)
2018 Jun 09
0
Date class shows Inf as NA; this confuses the use of is.na()
Hi Werner, on ?is.na it says: > The default method for anyNA handles atomic vectors without a class and NULL. I hear you, and it is confusing to say the least. Looking deeper, the culprit seems to be in the conversion of a Date to POSIXlt prior to the formatting: > x <- as.Date(Inf,origin = '1970-01-01') > is.na(as.POSIXlt(x)) [1] TRUE Given this implicit conversion,
2018 Jun 08
0
Date class shows Inf as NA; this confuses the use of is.na()
> as_date Error: object 'as_date' not found Must be from some not-named package... But don't confuse the format of an object when printed with its underlying value: > as.Date(Inf,origin = '1970-01-01') [1] NA > str(as.Date(Inf,origin = '1970-01-01')) Date[1:1], format: NA > as.numeric(as.Date(Inf,origin = '1970-01-01')) [1] Inf > is.na(Inf)
2018 Jun 12
0
Date class shows Inf as NA; this confuses the use of is.na()
I agree that calling it invalid is a bit confusing, but I?m not sure what the wording should be, as the problem is that the conversion to POSIXlt is failing. The best solution would be to extend the whole POSIXlt-class, but that?s too much work. I?ve done some experiments, and it also seems that the Date class can store larger values than POSIXlt: > as.Date(8e9,
2018 Jun 12
3
Date class shows Inf as NA; this confuses the use of is.na()
>>>>> Emil Bode >>>>> on Tue, 12 Jun 2018 12:00:42 +0000 writes: > I agree that calling it invalid is a bit confusing, but I?m not sure what the wording should be, as the problem is that the conversion to POSIXlt is failing. > The best solution would be to extend the whole POSIXlt-class, but that?s too much work. > I?ve done some experiments, and it
2018 Jun 11
0
Date class shows Inf as NA; this confuses the use of is.na()
>>>>> Joris Meys >>>>> on Sat, 9 Jun 2018 13:45:21 +0200 writes: > And now I've seen I copied the wrong part of ?is.na >> The default method for is.na applied to an atomic vector >> returns a > logical vector of the same length as its argument x, > containing TRUE for those elements marked NA or, for > numeric
2023 Apr 12
3
converting to date object...
dear members, I want to convert "12 APR 2023" into a Date object. I tried as_Date() from lubridate, but it is not working: > as_date("12 APR 2023") [1] NA Warning message: All formats failed to parse. No formats found. > as_date("12-APR-2023") [1] NA Warning message: All formats failed to parse. No formats found. I am looking for a
2023 Apr 12
1
converting to date object...
lubridate::dmy("12 APR 2023") On Wed, Apr 12, 2023 at 5:34?PM akshay kulkarni <akshay_e4 at hotmail.com> wrote: > dear members, > I want to convert "12 APR 2023" into a Date > object. I tried as_Date() from lubridate, but it is not working: > > > as_date("12 APR 2023") > [1] NA > Warning message: > All
2018 Jun 13
1
Date class shows Inf as NA; this confuses the use of is.na()
Greg, I see what you mean, but on the other hand, that's not how we think about real numbers working either, and doubles have that behavior generally. It might be possible to put checks in (with a potentially non-trivial overhead cost) to disallow that kind of thing, but again R (and everyone else, I think?) doesn't do so for regular doubles. Also, I would expect the year 1e50 and the
2023 Apr 12
1
converting to date object...
Hi, You do not need to use third party packages for date or date/time objects in R. If you review ?as.Date, you will see that there are two default formats for Date objects that are specified in the 'tryFormats' argument: ??tryFormats = c("%Y-%m-%d", "%Y/%m/%d") If your date character vector does not conform to either one, which it does not in this case, then you
2018 Feb 12
4
problema de fechas
hola Patricio, usa: dplyr::if_else [[alternative HTML version deleted]]
2013 Jun 12
1
Instant search for R documentation
Hi, I just wanted to share with you that we made a website over the weekend that allows "instant search" of the R documentation on CRAN, see: www.Rdocumentation.org. It's a first version, so any feedback/comments/criticism most welcome. Best regards, Jonathan [[alternative HTML version deleted]]
2016 Sep 08
2
Fwd: Re: RSiteSearch, sos, rdocumentation.org, ...?
On 8 September 2016 at 06:01, Jonathan Baron wrote: | We have over 10,000 packages now. I wonder if searching all help files | is really helpful anymore. Yes it is. I go to http://rdocumentation.org a lot for quick look-ups. So thanks to Datacamp for running that. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
2015 Oct 21
1
Confusing print method for Inf dates
x <- as.Date(Inf, origin = "1970-01-01") x #> [1] NA str(x) #> Date[1:1], format: NA unclass(x) #> [1] Inf It's not clear what the correct behaviour is. The documentation for ?Date has: "It is intended that the date should be an integer,", which suggests that -Inf and Inf are not valid dates. But if that's true the behaviour for max.Date() needs some
2018 Mar 22
2
how to add a child to a child in XML
Big thanks. newXMLNode works great. Wonder why it is not included in the documentation. There is newXMLDoc and newXMLNamespace, but no mention of newXMLNode. Stephen From: Ben Tupper [mailto:btupper at bigelow.org] Sent: Wednesday, March 21, 2018 6:18 PM To: Bond, Stephen Cc: r-help Subject: Re: [R] how to add a child to a child in XML Hi, XML doesn't use the `$` to access child nodes.
2015 Mar 11
2
Pregunta sobre Simplificación de Poligonales con R
Gracias, Jorge le echo un vistazo al link y te digo algo Un saludo Date: Wed, 11 Mar 2015 16:22:11 +0100 Subject: Re: [R-es] Pregunta sobre Simplificación de Poligonales con R From: jayusor en gmail.com To: fjroar en hotmail.com CC: r-help-es en r-project.org Hola, Esto lo hice algún tiempo para no hacer tan pesado los dibujos, si buscar por "R simplify shp" encuentras cosas, por
2016 Sep 08
3
Fwd: Re: RSiteSearch, sos, rdocumentation.org, ...?
On 9/8/2016 5:01 AM, Jonathan Baron wrote: > OK. It is sort of fixed and sort of works. > > We'll keep it for now, but this is not going to work forever. When > namazu fails completely I will not have the time to install a new > search engine. > > One option is to use google. For a site like this, I think they will > want some money, but I'm not sure, and I do not