similar to: max.col oddity

Displaying 20 results from an estimated 1000 matches similar to: "max.col oddity"

2006 Dec 14
0
max.col: bug or just oddity?
I've noticed that the max.col function with the default "random" option often gives unexpected results. For instance, in this test, it seems clear what the answer should be: > # second col should always be max > x1 = cbind(1:10, 2:11, -Inf) > > # this works fine > max.col(x1, "first") [1] 2 2 2 2 2 2 2 2 2 2 > > # this gives random answers >
2007 Mar 03
0
2 bugs in max.col() (PR#9542)
Dear R-Developers, I think I found two bugs in max.col(). Ties between zeros are not broken, which might affect simulations. -Inf and Zero can be treated the same, which can give completely wrong results, e.g. when the second max is sought by replacing all maxs by -Inf. To fix max.col I do offer the C-code behind my function rowMax(), which also handles NAs and seems to be faster. However,
2008 May 26
1
small documentation change: maxCol -> max.col in maxCol.Rd?
There is no function called 'maxCol' in 2.7.0, so should 'maxCol' be purged from maxCol.Rd and 'max.col' be promoted from an alias (and the file renamed)? from today's R-devel: /usr/local/src/R-devel> head ./src/library/base/man/maxCol.Rd % File src/library/base/man/maxCol.Rd % Part of the R package, http://www.R-project.org % Copyright 1995-2007 R Core
2009 Jul 14
1
Incorrect comment about ISNA(x) in Arith.h (PR#13826)
R-2.9.0/include/R_ext/Arith.h has: int R_IsNA(double); /* True for R's NA only */ int R_IsNaN(double); /* True for special NaN, *not* for NA */ int R_finite(double); /* True if none of NA, NaN, +/-Inf */ #define ISNA(x) R_IsNA(x) /* True for *both* NA and NaN. The first and last lines are contradictory - if R_IsNA is true only for NA, not NaN, then ISNA should be the same.
2008 Aug 02
1
problem with nested loop for regression
Hi everyone, I'm experiencing difficulty getting the results I want when I use a nested for loop. I have a data set to which I perform some calculations, and then try to apply a regression over a rolling window. The code runs, but the regression results I am getting (intercept and slope) are simply the same, repeated again and again in the results matrix. The regression does not seem to be
2008 Aug 15
2
cor() btwn columns in two matrices - no complete element pairs
Hi everyone, I'm trying to calculate correlation coefficients between corresponding columns in two matrices with identical dimensions but different data. The problem is that the matrices contain NAs in different locations. I am using the following code to try to calculate correlations between complete sets of data: #Code start maxcol<-ncol(mat1) for (i in 1:maxcol) {
2011 Nov 30
1
Error adding Bigmemory package
I am trying to add the bigmemory packages but I get the following error message: In file included from bigmemory.cpp:14:0: ../inst/include/bigmemory/isna.hpp: In function 'bool neginf(double)': ../inst/include/bigmemory/isna.hpp:22:57: error: 'isinf' was not declared in this scope make: *** [bigmemory.o] Error 1 ERROR: compilation failed for package 'bigmemory' * removing
2005 Jan 05
1
Standalone Mathlib, C++ and ISNAN()
In the hope of some meaningful response and ignoring the risk of further abuse, let me try to clarify the issue here. I have re-read the 'Writing R Extensions' manual. It seems to me that it clearly says R API functions can be called from from C++ programs, and the API includes the special values ISNAN() and R_FINITE() and the missing test ISNA(). R_FINITE is no problem. It is
2020 Sep 08
2
Re: [libnbd PATCH 1/2] generator: Refactor handling of closures in unlocked functions
On Mon, Sep 07, 2020 at 04:46:39PM -0500, Eric Blake wrote: > We have a memory leak when a function with a closure exits early prior > to registering that closure through some path that will guarantee > cleanup. The easiest way to fix it is to guarantee that once a > closure is passed into a public API, it will be cleaned regardless of > whether that API succeeds or fails. But to
2006 Apr 23
1
Question about bicreg
Dear Adrian and Ian (and r-helpers), I encountered a curious result in developing an example using the bicreg function in the BMA package: I noticed that pairs of models with equal R^2 and equal numbers of predictors had nevertheless different BIC values. Looking at the bicreg function, the definition of BIC appears to be the usual one, or close to it [bic <- n * log(1 - r2/100) + (size - 1) *
2009 Jun 18
2
Argument as.integer(NA) to a function C
Hi the list, I am writing a R function that call a C function. The C function needs integers but I do not manage to give a NA integer as argument : --- C code --- void essai(int *t){ Rprintf("\nT0=%i T1=%i T2=%i T3=%i",t[0],t[1],t[2],t[3]); } --- R --- boub <- c(1,2,3,4) .C("pour",as.integer(boub),NAOK=TRUE) # T0=1 T1=2 T2=3 T3=4[[1]] # [1] 1 2 3 4 boub <-
2019 Jan 21
0
orderVector1 (sort.c): Tiny improvement concerning nalast
Dear Sir, In the functions orderVector1, orderVector1l (R-3.5.2/src/main/sort.c) there are two loops concerning nalast (lines 1096, 1105). I am not sure about the possibility of redefining them, so this function should be a little faster. The first one (line 1096) can be included in the previous 'switch' block (line 1079) (see below). And if you rewrite/duplicate this 'switch'
2020 Jan 01
2
New R function is.nana = is.na & !is.nan
Hello R-devel, Best wishes in the new year. I am writing to kindly request new R function so NA_real_ can be more easily detected. Currently if one wants to test for NA_real_ (but not NaN) then extra work has to be done: `is.na(x) & !is.nan(x)` Required functionality is already at C level so to address my request there is not that much to do. Kevin Ushey made a nice summary of current R C api
2017 Jan 20
1
NaN behavior of cumsum
Hi! I noticed that cumsum behaves different than the other cumulative functions wrt. NaN values: > values <- c(1,2,NaN,1) > for ( f in c(cumsum, cumprod, cummin, cummax)) print(f(values)) [1] 1 3 NA NA [1] 1 2 NaN NaN [1] 1 1 NaN NaN [1] 1 2 NaN NaN The reason is that cumsum (in cum.c:33) contains an explicit check for ISNAN. Is that intentional? IMHO, ISNA would be better
2010 Jan 22
2
Optimizing C code
Hi the list, I need to write some efficient distances function, so I read the code for the Euclidean distance. I do not understand the purpose of the line 11 : if x[i] and y[i] are not NA (line 9), can dev be NA ? Christophe #define both_FINITE(a,b) (R_FINITE(a) && R_FINITE(b)) #define both_non_NA(a,b) (!ISNAN(a) && !ISNAN(b)) 1. static double R_euclidean2(double *x, double
2004 Apr 27
2
Gcc 3.4.0 and syslinux-2.09 menu
The menu directory won't compile with gcc 3.4.0 because gcc complains that "ebp" cannot be used as a constraint. If preserving ebp is necessary then it will have to be done in the assembler code. Gcc 3.3.3 just seems to ignore the constraint. It didn't do anything special to preserve the register. I also noticed that getnumrows returns the contents of 0x484 which is the
2001 Jan 25
1
problems compiling R under digital unix 4.0d (PR#826)
Dear Sirs, I am trying to compile R v1.2.1 under Digital Unix 4.0D. The configure-script runs without any problems but during 'make' I receive the following error-message: [......] g77 -mieee -g -O2 -c dtrco.f -o dtrco.o g77 -mieee -g -O2 -c dtrsl.f -o dtrsl.o g77 -mieee -g -O2 -c eigen.f -o eigen.o g77 -mieee -g -O2 -c lminfl.f -o lminfl.o ar cr libappl.a Rsock.o approx.o bakslv.o
2008 Oct 01
0
Simulating random draws
Hi, I have a data frame containing a column of human judgments, some of which are missing: > pr[3] label 1 4 2 4 3 4 4 4 5 NA 6 3 7 3 8 3 9 3 10 NA 11 NA 12 NA 13 2 14 2 15 2 16 NA 17 1 18 -1 19 -1 20 -1 Accompanying this is a matrix containing multinomial probabilities for the missing values, note that they
2002 Jan 22
1
compile problem with bessel_i.c on IRIX64 flexor 6.5 10100655 IP35 (uname -a) (PR#1275)
I have included the full configure/make output: (the particular error regarding bessel_i.c is at the END of the report). -walter tautz cd build/R-1.4.0 \ && unset noclobber \ && CPPFLAGS=" " \ LDFLAGS="" \ ./configure --prefix=/software/r-1 \ --datadir=/software/r-1/data \ --libdir=/software/r-1/lib \
2000 Oct 31
1
conflicting types for `Rf_stirlerr
I'm having trouble making todays development snapshot: -DHAVE_CONFIG_H -g -O2 -c stirlerr.c -o stirlerr.o stirlerr.c:34: conflicting types for `Rf_stirlerr' ../../src/include/R_ext/Mathlib.h:557: previous declaration of `Rf_stirlerr' make[3]: *** [stirlerr.o] Error 1 [20] /home/mfa5/gilp/R-versions/R-devel : uname -a SunOS mfa99579 5.6 Generic_105181-11 sun4u sparc SUNW,Ultra-5_10