Displaying 20 results from an estimated 500 matches similar to: "Incorrect comment about ISNA(x) in Arith.h (PR#13826)"
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
2020 Jan 02
1
New R function is.nana = is.na & !is.nan
"nana" is meant to express "NA, really NA".
Your suggestion sounds good.
On Thu 2 Jan, 2020, 3:38 AM Pages, Herve, <hpages at fredhutch.org> wrote:
> Happy New Year everybody!
>
> The name (is.nana) doesn't make much sense to me. Can you explain it?
>
> One alternative would be to add an extra argument (e.g. 'strict') to
> is.na(). FALSE by
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
2019 Sep 29
2
speed up R_IsNA, R_IsNaN for vector input
Dear R developers,
I spotted that R_isNA and R_IsNaN could be improved when applied on a
vector where we could take out small part of their logic, run it once,
and then reuse inside the loop.
I setup tiny plain-C experiment. Taking R_IsNA, R_IsNaN from R's
arithmetic.c, and building R_vIsNA and R_vIsNaN accordingly.
For double input of size 1e9 (having some NA and NaN) I observed
following
2011 Dec 02
1
1.6x speedup for requal() function (in R/src/main/unique.c)
Hi,
FWIW:
/* Taken from R/src/main/unique.c */
static int requal(SEXP x, int i, SEXP y, int j)
{
if (i < 0 || j < 0) return 0;
if (!ISNAN(REAL(x)[i]) && !ISNAN(REAL(y)[j]))
return (REAL(x)[i] == REAL(y)[j]);
else if (R_IsNA(REAL(x)[i]) && R_IsNA(REAL(y)[j])) return 1;
else if (R_IsNaN(REAL(x)[i]) && R_IsNaN(REAL(y)[j])) return 1;
2020 Jan 01
0
New R function is.nana = is.na & !is.nan
Happy New Year everybody!
The name (is.nana) doesn't make much sense to me. Can you explain it?
One alternative would be to add an extra argument (e.g. 'strict') to
is.na(). FALSE by default, and ignored (with or w/o a warning) when the
type of 'x' is not "numeric".
H.
On 12/31/19 22:16, Jan Gorecki wrote:
> Hello R-devel,
>
> Best wishes in the new
2008 Aug 16
1
unique.default problem (PR#12551)
Full_Name: Vilmos Prokaj
Version: R 2.7.1
OS: windows
Submission from: (NULL) (213.181.195.84)
Dear developers,
The following line of code (produced by a mistake) caused an infinite loop
unique("a",c("a","b"))
or also
unique(1,1:2)
I made a little investigation, and it seems to be that the following function
from unique.c is looping infinitely
static int
2004 Oct 22
1
Incompatibility between R-2.0.0 and Rggobi_1.0-0.
Hello,
I was trying to install Rggobi in the latest version of R and it gave me
a compilation error for
R CMD INSTALL Rggobi_1.0-0.tar.gz
RSGGobi.C: In function RS_GGOBI_init
(R_IsNaNorNA) undeclared (line 77)
I searched for this function in R src files and it was abandoned in
~/R-2.0.0/src/include/R_ext/Arith.h file.
Only functions
int R_IsNA(double); /* True for R's NA only */
2014 Feb 10
1
Question re: NA, NaNs in R
Hi R-devel,
I have a question about the differentiation between NA and NaN values
as implemented in R. In arithmetic.c, we have
int R_IsNA(double x)
{
if (isnan(x)) {
ieee_double y;
y.value = x;
return (y.word[lw] == 1954);
}
return 0;
}
ieee_double is just used for type punning so we can check the final
bits and see if they're equal to 1954; if they are, x is NA, if
they're
2006 Dec 16
1
max.col 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
>
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
2019 Sep 30
0
speed up R_IsNA, R_IsNaN for vector input
On 9/29/19 1:09 PM, Jan Gorecki wrote:
> Dear R developers,
>
> I spotted that R_isNA and R_IsNaN could be improved when applied on a
> vector where we could take out small part of their logic, run it once,
> and then reuse inside the loop.
Dear Jan,
Looking at your examples, I just see you have hand-inlined
R_IsNA/R_IsNaN, or is there anything more? In principle we could put
2011 Nov 20
2
Adding two or more columns of a data frame for each row when NAs are present.
I am fairly new to R and would like help with the problem below. I am
trying to sum and count several rows in the data frame yy below. All works
well as in example 1. When I try to add the columns, with an NA in Q21, I
get as NA as mySum. I would like NA to be treated as O, or igored.
I wrote a function to try to count an NA element as 0, Example 3 function.
It works with a few warnings,
2013 Jan 16
1
How to call Java main method using rJava package?
Hi,
I am trying to integrate my Java program with R using rJava package. I want
to execute the whole Java program from R. The main() method in my Java code
calls all the other defined methods. So, I guess I have to call the main()
method in .jcall.
An example Java code:
*class A {
public static int mySum(int x, int y) {
return x+y;
}
public static void
2011 Nov 10
3
optim seems to be finding a local minimum
Hello!
I am trying to create an R optimization routine for a task that's
currently being done using Excel (lots of tables, formulas, and
Solver).
However, otpim seems to be finding a local minimum.
Example data, functions, and comparison with the solution found in
Excel are below.
I am not experienced in optimizations so thanks a lot for your advice!
Dimitri
### 2 Inputs:
2007 Jun 28
3
Function call within a function.
I am trying to call a funtion within another function
and I clearly am misunderstanding what I should do.
Below is a simple example.
I know lstfun works on its own but I cannot seem to
figure out how to get it to work within ukn. Basically
I need to create the variable "nts". I have probably
missed something simple in the Intro or FAQ.
Any help would be much appreciated.
EXAMPLE
2007 Dec 07
4
Using R function in Excel
Does anyone know a way that an function written in R can be called within a cell of an Excel spreadsheet. I would like to use the R function much as I use the native Excel functions, e.g. instead of using the excel function sum, =sum(A2,A6), I would like to use the function mysum written in R, e.g. =mysum(A2,A6).
Thanks,
John
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
2011 Mar 30
3
optim and optimize are not finding the right parameter
Dear all,
I have a function that predicts DV based on one predictor pred:
pred<-c(0,3000000,7800000,15600000,23400000,131200000)
DV<-c(0,500,1000,1400,1700,1900)
## I define Function 1 that computes the predicted value based on pred
values and parameters a and b:
calc_DV_pred <- function(a,b) {
DV_pred <- rep(0,(length(pred)))
for(i in 1:length(DV_pred)){
DV_pred[i] <- a *
2008 Dec 07
5
How to force aggregate to exclude NA ?
The aggregate function does "almost" all that I need to summarize a datasets, except that I can't specify exclusion of NAs without a little bit of hassle.
> set.seed(143)
> m <- data.frame(A=sample(LETTERS[1:5], 20, T), B=sample(LETTERS[1:10], 20, T), C=sample(c(NA, 1:4), 20, T), D=sample(c(NA,1:4), 20, T))
> m
A B C D
1 E I 1 NA
2 A C NA NA
3 D I NA 3
4 C I
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