similar to: Inconsistencies when extracting with non-integer numeric indices near zero

Displaying 20 results from an estimated 2000 matches similar to: "Inconsistencies when extracting with non-integer numeric indices near zero"

2018 Oct 02
1
Relevel confusing with numeric value
Something that bit me: The function relevel takes a factor, and a reference level to be promoted to the first place. If ?ref? is a character this level is promoted, if it?s a numeric the ?ref?-th level is promoted. Which turns out to be very confusing if you have factor with numeric values (e.g. when reading in a csv with some dirty numeric columns and stringsAsFactors TRUE) For example:
2018 Jul 24
0
oddity in transform
I think you meant to call BOD[,1] From ?transform, the ... arguments are supposed to be vectors, and BOD[1] is still a data.frame (with one column). So I don't think it's surprising transform gets confused by which name to use (X, or Time?), and kind of compromises on the name "Time". It's also in a note in ?transform: "If some of the values are not vectors of the
2018 Sep 14
0
Bug when calling system/system2 (and request for Bugzilla account)
I can't reproduce this. Can you be more precise: exactly where are you putting the system2 call and exactly where are you sending the interrupt signal with ^C? Best, luke On Fri, 14 Sep 2018, Emil Bode wrote: > Hi all, > > I found some strange behaviour, which I think is a bug. Could someone make an account for me on Bugzilla or pass on my report? > > The problem: > When
2018 Jul 30
0
apply with zero-row matrix
Hi David, Besides Martins point, there is also the issue that for a lot of cases you would still like to have the right class returned. Right now these are returns: > apply(matrix(NA_integer_,0,5), 1, class) character(0) > apply(matrix(NA_integer_,0,5), 1, identity) integer(0) > apply(matrix(NA,0,5), 1, identity) logical(0) In your case,
2018 Jul 24
0
oddity in transform
I don't think it has much to do with transform in particular: > BOD <- data.frame(Time = 1:6, demand = runif(6)) > BOD[["X"]] <- BOD[1:2] * seq(6); BOD Time demand X.Time X.demand 1 1 0.8649628 1 0.8649628 2 2 0.5895380 4 1.1790761 3 3 0.6854635 9 2.0563906 4 4 0.4255801 16 1.7023206 5 5 0.5738793 25 2.8693967 6 6 0.9996713
2018 Oct 15
0
sys.call() inside replacement functions incorrectly returns *tmp*
Hi, Agreed that it would be better if sys.call() were to return "x" instead of "*tmp*", as it behaves as a local variable. Although I'm not sure what problem it would solve, the effect here is comparable to what happens when calling a function indirectly (although then you could use sys.call(2), which here doesn't work). But your other suggestion, accepting
2018 Sep 14
0
Bug when calling system/system2 (and request for Bugzilla account)
FWIW I can reproduce on macOS with R 3.5.1. A smaller example: system2("ls", timeout = 5); x <- sample(1:1E8) If I try to interrupt R while that sample call is running, R itself is closed. Best, Kevin On Fri, Sep 14, 2018 at 10:53 AM Emil Bode <emil.bode at dans.knaw.nl> wrote: > > I hope it's not too specific in my setup... > I've tried with system2
2018 Aug 30
0
ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1
I have to disagree, I think one of the advantages of '||' (or &&) is the lazy evaluation, i.e. you can use the first condition to "not care" about the second (and stop errors from being thrown). So if I want to check if x is a length-one numeric with value a value between 0 and 1, I can do 'class(x)=='numeric' && length(x)==1 && x>0
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 Jul 24
2
oddity in transform
The idea is that one wants to write the line of code below in a general way which works the same whether you specify ix as one column or multiple columns but the naming entirely changes when you do this and BOD[, 1] and transform(BOD, X=..., Y=...) or other hard coding solutions still require writing multiple cases. ix <- 1:2 transform(BOD, X = BOD[ix] * seq(6)) On Tue, Jul 24, 2018 at
2018 Sep 14
3
Bug when calling system/system2 (and request for Bugzilla account)
Hi all, I found some strange behaviour, which I think is a bug. Could someone make an account for me on Bugzilla or pass on my report? The problem: When pressing Ctrl-C when a file is sourced in R, run from Terminal (macOS), sometimes the entire session is ended right away, while I just want to stop the script. This is the case when I press Ctrl-C while some functions are running that don?t
2018 Sep 14
2
Bug when calling system/system2 (and request for Bugzilla account)
I hope it's not too specific in my setup... I've tried with system2 added on the first line, so: Example.R: system2('ls', timeout=5) cat('Start non-interruptable functions\n') sample_a <- sample(1:1e7) sample_b <- sample(1:2e7) matching <- match(sample_a, sample_b) cat('Finished\n') Sys.sleep(10) And in terminal/bash: R --vanilla
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 Aug 15
0
validspamobject?
Hello, If you want to determine where the warning is generated, I think it's easiest to run R with options(warn=2). In that case all warnings are converted to errors, and you have more debugging tools, e.g. you can run traceback() to see the calling stack, or use options(error=recover). Hope you can catch it. Best regards, Emil Bode is an institute of the Dutch Academy KNAW
2018 Jul 23
2
oddity in transform
Note the inconsistency in the names in these two examples. X.Time in the first case and Time.1 in the second case. > transform(BOD, X = BOD[1:2] * seq(6)) Time demand X.Time X.demand 1 1 8.3 1 8.3 2 2 10.3 4 20.6 3 3 19.0 9 57.0 4 4 16.0 16 64.0 5 5 15.6 25 78.0 6 7 19.8 42 118.8 >
2018 Nov 29
0
Unexpected argument-matching when some are missing
On Thu, Nov 29, 2018 at 5:09 AM Emil Bode <emil.bode at dans.knaw.nl> wrote: > > When trying out some variations with `[.data.frame` I noticed some (to me) odd behaviour, which I found out has nothing to do with `[.data.frame`, but rather with the way arguments are matched, when mixing named/unnamed and missing/non-missing arguments. Consider the following example: > > > >
2018 Nov 30
0
Unexpected argument-matching when some are missing
Argument matching is by name first, then the still missing arguments are filled positionally. Unnamed missing arguments are thus left missing. Does that help? Michael On Fri, Nov 30, 2018 at 8:18 AM Emil Bode <emil.bode at dans.knaw.nl> wrote: > > But the main point is where arguments are mixed together: > > > debugonce(plot.default) > > plot(x=1:10, y=, 'l')
2018 Aug 29
7
ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1
# Issue 'x || y' performs 'x[1] || y' for length(x) > 1. For instance (here using R 3.5.1), > c(TRUE, TRUE) || FALSE [1] TRUE > c(TRUE, FALSE) || FALSE [1] TRUE > c(TRUE, NA) || FALSE [1] TRUE > c(FALSE, TRUE) || FALSE [1] FALSE This property is symmetric in LHS and RHS (i.e. 'y || x' behaves the same) and it also applies to 'x && y'.
2018 Dec 03
1
Unexpected argument-matching when some are missing
>>>>> Michael Lawrence >>>>> on Fri, 30 Nov 2018 08:24:31 -0800 writes: > Argument matching is by name first, then the still missing > arguments are filled positionally. Unnamed missing > arguments are thus left missing. Does that help? Thank you, Michael! Unfortunately, it may not help sufficiently notably once this thread will be
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