search for: naok

Displaying 20 results from an estimated 55 matches for "naok".

Did you mean: nak
2009 Jun 18
2
Argument as.integer(NA) to a function C
...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 <- c(1,2,NA,4) .C("essai",as.integer(boub),NAOK=TRUE) # T0=1 T1=2 T2=-2147483648 T3=4[[1]] # [1] 1 2 NA 4 --- --- In the second example, T2=-2147483648 and not NA. I check the "writing R extension", there is a part t...
2005 Jun 06
1
Missing values in argument of .Fortran.
...s of .Fortran(). The subroutine runs through the vector entry by entry; obviously I want to have it do one thing if y[i] is present and a different thing if it is missing. The way I am thinking of proceeding is along the xlines of: ymiss <- is.na(y) rslt <- .Fortran( "foo", NAOK=TRUE, as.double(y), as.logical(ymiss), etc, etc ) and inside ``foo'' have a logical branch based on the value of xmiss(i). Questions: (1) Is there a sexier way to proceed? E.g. is it possible within (g77) fortran to detect the fact that y(i) is/was an NA (or not) and make th...
1997 Aug 25
2
R-alpha: eigen and batch
Batch: Putting q(save=F) at the end of my file does not work in my context because I can no longer source the file without quitting. I have that quit statement in my .First so that I always quit that way interactively. The problem is that it is ignored in batch. eigen: The crash occurs on my 586 running Red Hat Linux 2.0.27 but not on my son's 486 running SLackware Linix 2.0.29. We both
2007 Dec 31
2
the woes of NA
Joyful. I'm adapting a FORTRAN 77 package for use with R. Pretty straightforward. Except for a glitch it took me some time to figure out. This existing package has subroutines which have parameters called "NA". So, I called subroutines like bnodes <- function(n, lst, lptr, lend, nodes, nb, na, nt) { ensure.all.numeric(list(n, lst, lptr, lend, nodes, nb, n.a, nt),
2010 Dec 08
1
Newbie trying to understand $ so I can understand acf function in stats
...aving trouble understanding the usage "$acf" in the following acf <- array(.C(R_acf, as.double(x), as.integer(sampleT), as.integer(nser), as.integer(lag.max), as.integer(type == "correlation"), acf = double((lag.max + 1L) * nser * nser), NAOK = TRUE)$acf, c(lag.max + 1L, nser, nser)) I interpret it as ... we are forming an array of dimensionality 3, and the contents of the array come from invoking a C program R_acf while the values of the 3 dimensions are lag.max + 1L, nser, and nser. simplified acf<-array(.C(args)$acf, c(some di...
2006 Jul 17
3
information about a function
...I have simply something like this: > f<-approxfun(data[,1],data[,2]) and f is: > f function (v) .C("R_approx", as.double(x), as.double(y), as.integer(n), xout = as.double(v), as.integer(length(v)), as.integer(method), as.double(yleft), as.double(yright), as.double(f), NAOK = TRUE, PACKAGE = "base")$xout <environment: 02106C24> I also used "locPoly". Both yield either a function or a data frame of values. Is there a way to get a mathematical representation of the function, e.g. a polynomial of any order? Something like ax^3+bx^2+cx^1+d or...
2017 Oct 21
1
Illegal Logical Values
> On Fri, 2017-10-20 at 14:01 +0000, brodie gaslam via R-devel wrote: > > I'm thinking of this passage: > > > > > Logical values are sent as 0 (FALSE), 1 (TRUE) or INT_MIN = > > > -2147483648 (NA, but only if NAOK is true), and the compiled code > > > should return one of these three values. (Non-zero values other > > > than INT_MIN are mapped to TRUE.) > > > > The parenthetical seems to suggest that something like 'LOGICAL(x)[0] > > = 2;' will be treated as TRUE...
2008 Apr 24
1
Passing Inf from R to C using .C("myLibC"...
Dear all, How can I pass '-Inf' and 'Inf' values from R to C code using the function '.C(...)'. When running my code, I get an error since C does not recognize -Inf and Inf values. Of course, I could use instead a very low (or high) number, but I was wondering whether a more elegant solution exists. Thanks for your help. -- David Ardia H-building, room 11-26
2011 Sep 23
0
(Requested) caTools::runmean Patch
...unlike the call for the "C" algorithm, the "exact" algorithm does not make sure that x is stored as double resulting in occasional unexpected behavior. ## From caTools::runmean if (alg == "exact") { .C("runmean_exact", x, y, as.integer(n), as.integer(k), NAOK = TRUE, DUP = FALSE, PACKAGE = "caTools") } else if (alg == C"){ .C("runmean", as.double(x), y, as.integer(n), as.integer(k), NAOK = TRUE, DUP = FALSE, PACKAGE = "caTools") } Thanks once again for the fantastic package, Michael Weylandt cc: R-Help List. [...
1997 Aug 22
2
R-alpha: eigen
eigen(matrix(rep(1,9),ncol=3),only.values=T) works repeatedly but eventually (after 3 or 4 goes) gave a core dump of 11mb (I think only the first answer was right). if I type gc() immediately after the first call, I get a core dump right away (this might possibly be related to my huge core dumps with nlm) eigen(matrix(rep(1,9),ncol=3)) core dumps immediately after the first call Jim
2009 Jul 20
1
tabulate can accept NA values?
...as.integer(bin), as.integer(length(bin)), as.integer(nbins), ans = integer(nbins), PACKAGE="base")$ans The implementation of R_tabulate has if(x[i] != R_NaInt && x[i] > 0 && x[i] <= *nbin) and so copes with (silently drops) NA. Perhaps the .C could have NAOK=TRUE? This is useful in apply'ing tabulate to the rows or columns of a (large) matrix, where the work-around involves introducing some artificial NA value (and consequently copying the matrix) outside the range of tabulate's nbin argument. Martin -- Martin Morgan Computational Biology /...
1999 Jan 22
1
two questions
A non-text attachment was scrubbed... Name: not available Type: text Size: 722 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/19990122/cea14ffd/attachment.pl
2013 Feb 14
1
approxfun values
...0 NA > testinterpolationvalues<-approxfun(testinterpolation,y=NULL) > testinterpolationvalues function (v) .C(C_R_approxfun, as.double(x), as.double(y), as.integer(n), xout = as.double(v), as.integer(length(v)), as.integer(method), as.double(yleft), as.double(yright), as.double(f), NAOK = TRUE, PACKAGE = "stats")$xout <bytecode: 0x33ffab84> <environment: 0x34072eac> > testinterpolationvalues<-approx(testinterpolation,y=NULL) > testinterpolationvalues $x [1] 10.00000 11.63265 13.26531 14.89796 16.53061 18.16327 19.79592 21.42857 [9] 23.06122 24....
2005 Jul 21
1
cut in R
...stop("labels/breaks length conflict") code <- .C("bincode", x = as.double(x), n = as.integer(length(x)), breaks = as.double(breaks), as.integer(nb), code = integer(length(x)), right = as.logical(right), include = as.logical(include.lowest), naok = TRUE, NAOK = TRUE, DUP = FALSE, PACKAGE = "base")$code if (codes.only) code else factor(code, seq(labels), labels) } ************************************************************************************** Steve Su (s.su@qut.edu.au) Postdoctoral fellow Faculty...
2017 Oct 20
1
Illegal Logical Values
I'm wondering if WRE Section 5.2 should be a little more explicit about misuse of integer values other than NA, 0, and 1 in LGLSXPs.? I'm thinking of this passage: > Logical values are sent as 0 (FALSE), 1 (TRUE) or INT_MIN = -2147483648 (NA, but only if NAOK is true), and the compiled code should return one of these three values. (Non-zero values other than INT_MIN are mapped to TRUE.) The parenthetical seems to suggest that something like 'LOGICAL(x)[0] = 2;' will be treated as TRUE, which it sometimes is, and sometimes isn't: not.true...
2007 Mar 15
1
How to use result of approxfun in a package?
...ation of function f1. The value of approxfun is a function; for example, I have > f1 function (v) .C("R_approx", as.double(x), as.double(y), as.integer(n), xout = as.double(v), as.integer(length(v)), as.integer(method), as.double(yleft), as.double(yright), as.double(f), NAOK = TRUE, PACKAGE = "base") $xout <environment: 0x17719324> I don't really understand how this is stored, and in particular, how I should handle it so as to include the function f1 in a package. I would like the users to be able to load the package and use f1 directly, rat...
2009 Jul 21
1
bug in approx crashes R
Dear R-devel, The following line crashes R > approx(1, 1, 0, method='const', rule=2, f=0, yleft=NULL, ties='ordered')$y Process R:2 exited abnormally with code 5 at Tue Jul 21 14:18:09 2009 > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 9.1 year
1997 Aug 05
1
R-beta: Characters in .C
I am having some difficulties using dynamically loaded C functions on a Sparc 10 with R compiled using cc (both R-0.49 and R-0.50). I get sporadic errors with the error message: Error: character variables must be duplicated in .C/.Fortran, with C functions which pass character variables. my C functions look like: anyfunc(char **filename, other variables ) This error message appears about 25%
1997 Aug 05
1
R-beta: Characters in .C
I am having some difficulties using dynamically loaded C functions on a Sparc 10 with R compiled using cc (both R-0.49 and R-0.50). I get sporadic errors with the error message: Error: character variables must be duplicated in .C/.Fortran, with C functions which pass character variables. my C functions look like: anyfunc(char **filename, other variables ) This error message appears about 25%
2009 Jul 14
1
Incorrect comment about ISNA(x) in Arith.h (PR#13826)
...sum is NA" WARNING(NULL_ENTRY); if (ISNAN(sum)) PROBLEM "sum is NAN" WARNING(NULL_ENTRY); if (!(R_FINITE(sum))) PROBLEM "sum is not finite" WARNING(NULL_ENTRY); return; } > dyn.load("~/R/work/bug.so") > .C("mysum", c(NaN, 0.0, 0.0), NAOK = TRUE, DUP = FALSE) [[1]] [1] NaN 0 0 Warning messages: 1: sum is NAN 2: sum is not finite --please do not edit the information below-- Version: platform = x86_64-unknown-linux-gnu arch = x86_64 os = linux-gnu system = x86_64, linux-gnu status = major = 2 minor = 9.0 year = 200...