similar to: Confusing print method for Inf dates

Displaying 20 results from an estimated 20000 matches similar to: "Confusing print method for Inf dates"

2019 Mar 06
1
as.Date(Inf) displays as 'NA' but is actually 'Inf'
>>>>> Gabriel Becker >>>>> on Tue, 5 Mar 2019 22:01:37 -0800 writes: > On Tue, Mar 5, 2019 at 9:54 PM Richard White <w at rwhite.no> wrote: >> Hi Gabriel, >> >> The point is that it *visually* displays as NA, but is.na() still >> responds as FALSE. >> >> When I (and I am sure many people)
2023 Nov 06
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
Hmm, it is not actually at odds with help(c), it is just that the autocoercion works different that it used to, so that as.complex(NA) == as.complex(NA_real) == NA_real_+0i) which now differs from NA_complex although both print as NA. I haven't been quite alert when this change was discussed, but it does look a bit unfortunate that usage patterns like c(NA, 0+1i) does not give complex NA
2019 May 26
2
rbind has confusing result for custom sub-class (possible bug?)
On Sun, May 26, 2019 at 4:06 AM Michael Chirico <michaelchirico4 at gmail.com> wrote: > > Have finally managed to come up with a fix after checking out sys.calls() > from within the as.Date.IDate debugger, which shows something like: > > [[1]] rbind(DF, DF) > [[2]] rbind(deparse.level, ...) > [[3]] `[<-`(`*tmp*`, ri, value = 18042L) > [[4]] `[<-.Date`(`*tmp*`,
2019 May 27
2
rbind has confusing result for custom sub-class (possible bug?)
Yes, thanks for following up on thread here. And thanks again for clearing things up, your email was a finger snap of clarity on the whole issue. I'll add that actually it was data.table's code at fault on the storage conversion -- note that if you use an arbitrary sub-class 'foo' with no methods defined, it'll stay integer. That's because [<- calls as.Date and then
2023 Nov 08
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
So, to summarize, the open questions are: (1) Should as.complex(NA_character_) give complex(r=NA_real_, i=0) instead of NA_complex_? (2) Should the first argument in c(NA, x) and c(NA_integer_, x), where typeof(x) == "complex", be promoted to complex(r=NA_real_, i=0) instead of NA_complex_? My opinions: (1) No. The imaginary part of the
2012 Apr 19
1
SmoothTrend in OpenAir
I'm trying to plot smooth trend using smoothTrend in OpenAir but I'm having problems. I used the following code. --------------------------------------------------------------------------------- #Set my working dir to the dir with my files setwd("c:/R") #Load the openair library library(openair) #Load the data mydata <- read.table("MCNP-pH.csv", header=TRUE,
2023 Nov 09
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
>>>>> Mikael Jagan >>>>> on Wed, 8 Nov 2023 11:13:18 -0500 writes: > So, to summarize, the open questions are: > (1) Should as.complex(NA_character_) give complex(r=NA_real_, i=0) > instead of NA_complex_? > (2) Should the first argument in c(NA, x) and c(NA_integer_, x), > where typeof(x) == "complex", be promoted
2013 Dec 12
2
Status of reserved keywords and builtins
According to http://cran.r-project.org/doc/manuals/r-release/R-lang.html#Reserved-words if else repeat while function for in next break TRUE FALSE NULL Inf NaN NA NA_integer_ NA_real_ NA_complex_ NA_character_ ... ..1 ..2 etc. are all reserved keywords. However, in R 3.0.2 you can do things like: `if` <- function(cond, val1, val2) val2 after which if(TRUE) 1 else 2 returns 2.
2018 Jan 22
1
as.character(list(NA))
I tend to avoid using as.<type> functions on lists, since they act oddly in several ways. E.g, if the list "L" consists entirely of scalar elements then as.numeric(L) acts like as.numeric(unlist(L)) but if any element is not a scalar there is an error. as.character() does not seem to make a distinction between the all-scalar and not-all-scalar cases but does various things with
2015 Aug 12
2
Weird issue when iterating through dates
I am not sure if this is a bug or not. Gabor On Wed, Aug 12, 2015 at 11:51 AM, Luca Cerone <luca.cerone at gmail.com> wrote: > Following up on this, should I report a bug? can you drive me through > the process? > > Cheers, > Luca > > On Thu, Aug 6, 2015 at 4:55 PM, William Dunlap <wdunlap at tibco.com> wrote: >>>> Just a quick question: what's
2016 Dec 06
1
segfault with POSIXlt zone=NULL zone=""
Hi Joshua, Thank you for minimizing my test case. > > Hope I'm not doing something illegal... > > > You are. You're changing the internal structure of a POSIXlt object > by re-ordering the list elements. You should not expect a malformed > POSIXlt object to behave as if it's correctly formed. You can see > it's malformed by comparing it's
2019 Mar 06
2
as.Date(Inf) displays as 'NA' but is actually 'Inf'
Hi Gabriel, The point is that it *visually* displays as NA, but is.na() still responds as FALSE. When I (and I am sure many people) see an NA, we then use is.na(). If we see Inf displayed, we then use is.infinite(). With as.Date() this breaks down. I'm not arguing that as.Date(Inf) should be coerced to NA. I'm arguing that as.Date(Inf) should be *visually* displayed as Inf (i.e. the
2016 Jul 16
1
sample() fails with double or integer NA input of length one
Hi, I have discovered that sample() fails with an uninformative error message when the x argument is a single NA of type double or integer. I can reproduce the problem with the following code: base::sample(NA) # NA is of logical type above base::sample(NA_character_) base::sample(NA_complex_) base::sample(NA_real_) base::sample(NA_integer_) The last two lines throw the following error: Error
2018 Jan 22
2
as.character(list(NA))
On 01/20/2018 08:24 AM, William Dunlap via R-devel wrote: > I believe that for a list as.character() applies deparse() to each element > of the list. deparse() does not preserve NA-ness, as it is intended to > make text that the parser can read. > >> str(as.character(list(Na=NA, LglVec=c(TRUE,NA), > Function=function(x){x+1}))) > chr [1:3] "NA" "c(TRUE,
2020 May 23
2
Should 0L * NA_integer_ be 0L?
I don't see this specific case documented anywhere (I also tried to search the r-devel archives, as well as I could); the only close reference mentions NA & FALSE = FALSE, NA | TRUE = TRUE. And there's also this snippet from R-lang: In cases where the result of the operation would be the same for all > possible values the NA could take, the operation may return this value. >
2017 Aug 10
3
Zoo rolling window with increasing window size
Hi Joshua, thanks for your prompt reply. However as I said, sum() function I used here just for demonstrating the problem, I have other custom function to implement, not necessarily sum() I am looking for a generic solution for above problem. Any better idea? Thanks, On Fri, Aug 11, 2017 at 12:04 AM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote: > Use a `width` of integer index
2019 Jul 01
2
R-Forge > GitHub?
Apparently you created id_rsa key pair with a passphrase. Passphrase is like an additional password protection layer on your ssh key. I don't know how did you create it. But you can always create a new one (you should delete the old one before you create a new one) using the shell command 'ssh-keygen'. It asks for a passphrase, just push enter for an empty passphrase (twice). You
2019 Jun 02
1
rbind has confusing result for custom sub-class (possible bug?)
I thought it would be good to summarize my thoughts, since I made a few hypotheses that turned out to be false. This isn't a bug in base R, in either rbind() or `[<-.Date`. To summarize the root cause: base::rbind.data.frame() calls `[<-` for each column of the data.frame, and there is no `[<-.IDate` method to ensure the replacement value is converted to integer. And, in fact,
2009 Jun 03
2
Create a time interval from a single time variable
I am trying to set up a data set for a survival analysis with time-varying covariates. The data is already in a long format, but does not have a variable to signify the stopping point for the interval. The variable DaysEnrolled is the variable I would like to use to form this interval. This is what I have now: ID Age DaysEnrolled HAZ WAZ WHZ Food onARV
2008 Apr 29
1
data management (subsetting and recombining)
This is an example of two months of data from a twenty four month data set that I would like to apply this too. These data are subsets of the same stations throught time, but differing ones were included on different sampling dates. I would like to subset these data and then put them together as a big matrix with the by column being RiverMile. What is the easiest way to proceed as this is a