Displaying 20 results from an estimated 2000 matches similar to: "Argument as.integer(NA) to a function C"
2012 Feb 26
2
Dealing with NAs in C
Hi.
I am currently converting a lot of R code to C in order to make it more
efficient. A lot of the data involves NAs. As the data is mainly integers >
0, I am just setting all NAs to 0 then sending it to the C code then
resetting them to NAs again after the C program is done, to be compatible
with the rest of the R code.
Is there a more efficient way to deal with NAs in C? I have used
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.
2005 Jun 06
1
Missing values in argument of .Fortran.
I wish to pass a vector ``y'', some of whose entries are NAs to a
fortran subroutine which I am dynamically loading and calling by
means 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)
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
>
2007 Jul 17
4
[R-sig-DB] RODBC on Oracle DB
essai <- odbcConnect("ORESTE_prod", uid="osis_r", pwd="12miss15" ,case="oracle")
> sqlTables(essai)$ORESTE
...
1315 <NA> ORESTE S_PROFESSIONS_OLD TABLE <NA>
1316 <NA> ORESTE S_PROVENANCES TABLE <NA>
1317 <NA> ORESTE
2012 Nov 16
2
How to create as.numeric.xxx
I would like to create a function to convert data based on a class using
as.numeric
Similarly, using a plot, I do:
plot.essai <- function(x, ...) {return(x*2)}
d <- 10
class(d) <- "essai"
plot(d)
It works:
[1] 20
attr(,"class")
[1] "essai"
Now same with as.numeric:
as.numeric.essai <- function(x, ...) {return(x*2)}
as.numeric(d)
It does not work:
2012 Aug 08
2
Exec resource don't write file after the command
Hi all,
I''m trying to have the exec resource write a file after the command but it
don''t.
here is the resource declaration
class gepet {
notify { ''begin'':}
file { ''/root/essai/html'':
ensure => present,
content => "Wrote By Yves Nton",
notify => Exec[''test''],
}
exec { ''test'':
path
2011 Dec 02
2
Problem with loop
Hi,
I try to build a loop difficultly.
I have in a folder called Matrices several files (.csv) called Mat2002273,
Mat2002274 to Mat2002361.
I want to calculate for each file the mean of the column called Pixelvalues.
I try this code but as result, I have this message: Mat2002273 not found
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,
2004 Mar 31
3
scan seems to modify the data
Hello list,
I have used scan function to import data into R. I have done some analysis
and find strange results. I have found my problem : when importing data
with scan, this can slightly modify the data :
> write(c(0.251,3.399,-0.481,0.266),"essai.txt")
> scan("essai.txt")
Read 4 items
[1] 0.251 3.399 -0.481 0.266
> print(scan("essai.txt"),17)
Read
2005 Dec 27
2
Create pdf and postscript files
Hello,
I would like to learn how to create a pdf and a postscript file from an R
graphic.
For example, I tried :
plot(1) # example
pdf("H:/Perso/essai.pdf")
postscript("H:/Perso/essai.ps")
But the pdf document created is empty.
How do these functions work ?
Thank you very much.
--
David Hajage
Interne de santé publique
Institut Curie
2008 Apr 13
1
R 2.7 package.skeleton
Hi the devel list
I am testing package.skeleton in R 2.7 (download today). I get an error
that I do not understand. I guess it is not an error from my code since
I have no probleme when I source it. So is it a error in
package.skeleton?
Here is my code :
--- 8< ------ File essai.r -------------
setClass(
Class="ClusterizLongData",
representation=representation(
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
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
2006 Nov 11
1
Install bioconductor
Hello useRs,
I'm trying to install bioconductor on ubuntu edgy eft and R 2.4.0.
I have some error messages during installation, in particular for the
package "affy" :
"Error: package 'affy' required by 'makecdfenv' could not be found"
I have tryed to install 'makecdfenv' with the command :
getBioC("makecdfenv")
But I have this message
2012 Jan 12
2
defmacro installation issue
Hi everybody,
I want to use macro in my R code. But defmacro was not in my libraries. So I
installed it :
> install.packages("gtools")
Installing package(s) into ?C:/Program Files/R/R-2.13.2/library?
(as ?lib? is unspecified)
essai de l'URL
'http://cran.cict.fr/bin/windows/contrib/2.13/gtools_2.6.2.zip'
Content type 'application/zip' length 102500 bytes (100 Kb)
1999 Oct 08
1
floor(NaN) problem fixed in massdist.c (PR#291)
Full_Name: Naoki Takebayashi
Version: 0.65.0+R-release.diff (Oct 6, 1999)
OS: Linux/Alpha
Submission from: (NULL) (129.79.224.171)
This will fix the "problem 2 (crash in fft)" in Bug ID #277
On Linux/Alpha, make check failed because R could not handle the following
example in base-Ex.R
##___ Examples ___:
# The Old Faithful geyser data
data(faithful)
:
:
## Missing values:
x <-
2006 Dec 22
2
Pb with R.matlab
Hello,
I have problems running the R.matlab package. I work with R 2.3.1, under
windows (using the Rgui). It seems that, even after loading the package,
the "simple" functions such as writeMat() or readMat() are not recognized.
For example, the following script leads to an error:
> install.packages("R.matlab")
--- Please select a CRAN mirror for use in this session ---
2010 Dec 08
1
Newbie trying to understand $ so I can understand acf function in stats
I am trying to understand the function acf
stats:::acf shows me the function
I am having 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 =
2006 Jul 17
3
information about a function
Hi people,
I am new in this list and could not find a FAQ for it in particular,
furthermore I could not find my question answered in the official R
FAQ or docs.
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)),