Displaying 20 results from an estimated 600 matches similar to: "Dealing with NAs in C"
2019 Jan 11
2
strtoi output of empty string inconsistent across platforms
Identified as root cause of a bug in data.table:
https://github.com/Rdatatable/data.table/issues/3267
On my machine, strtoi("", base = 2L) produces NA_integer_ (which seems
consistent with ?strtoi: "Values which cannot be interpreted as integers or
would overflow are returned as NA_integer_").
But on all the other machines I've seen, 0L is returned. This seems to be
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 11
2
strtoi output of empty string inconsistent across platforms
>>>>> Martin Maechler
>>>>> on Fri, 11 Jan 2019 09:44:14 +0100 writes:
>>>>> Michael Chirico
>>>>> on Fri, 11 Jan 2019 14:36:17 +0800 writes:
>> Identified as root cause of a bug in data.table:
>> https://github.com/Rdatatable/data.table/issues/3267
>> On my machine, strtoi("", base =
2009 Jan 30
2
Problem installing RMySQL ("S4R.h:40:17: error: S.h: No such file or directory"?)
Hi,
I'm trying to install RMySQL and I keep hitting errors. My computer is:
uname -a
Linux cricket 2.6.18-92.1.22.el5PAE #1 SMP Tue Dec 16 12:36:25 EST 2008 i686
i686 i386 GNU/Linux
I have set the following environment settings:
export PKG_LIBS="-L/usr/lib/mysql -lmysqlclient"
export PKG_CPPFLAGS="-I/usr/include/mysql"
I run the following command:
R CMD INSTALL
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
>
2012 Nov 05
1
Potencia de la prueba T
Buen día para todos los que ven este correo.
En estos días estoy estudiando la potencia de una prueba en inferencia,
pero no entiendo bien como
correr un codigo que lo haga pertinentemente, el codigo que corro es el
siguiente, la idea es que a medida que crece
el tamaña muestral pues la potencia de la prueba aumente, pero no se como
hacer para que, repita la prueba variando el tamaño de la
Control statements with condition with greater than one should give error (not just warning) [PATCH]
2017 Mar 03
2
Control statements with condition with greater than one should give error (not just warning) [PATCH]
I'd like to propose that the whenever the length of condition passed
to an if or a while statement differs from one, an error is produced
rather than just a warning as today:
> x <- 1:2
> if (x == 1) message("x == 1")
x == 1
Warning message:
In if (x == 1) message("x == 1") :
the condition has length > 1 and only the first element will be used
There are
2006 Jan 21
1
A patch for do_sample: check replace arg
A colleague sent me the following:
If you specify probabilities in the 'sample' function and forget
to type 'prob=...', then you get nonsense. E.g.
sample(1:10,1,c(0,0,0,0,1,0,0,0,0,0))
does not filter '5', while
sample(1:10,1,prob=c(0,0,0,0,1,0,0,0,0,0))
does it correctly. I wish this would return an error because the
2002 Mar 08
1
1st January isn't (PR#1370)
In today's pre1.5.0
> ISOdate(2002,1,1)
[1] "2002-03-01 04:00:00 PST"
> ISOdate(2002,1,1)==ISOdate(2002,3,1)
[1] TRUE
It doesn't seem to happen for days other than 1/1
-thomas
> version
_
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status Under development (unstable)
major 1
minor 5.0
year 2002
month
2015 May 17
1
The function cummax() seems to have a bug.
Hi,
The function cummax() seems to have a bug.
> x <- c(NA, 0)
> storage.mode(x) <- "integer"
> cummax(x)
[1] NA 0
The correct result of this case should be NA NA. The mistake in [
https://github.com/wch/r-source/blob/trunk/src/main/cum.c#L130-L136] may be
the reason.
Best Regards,
Dongcan
--
Dongcan Jiang
Team of Search Engine & Web Mining
School of Electronic
2025 Apr 10
1
table() and as.character() performance for logical values
Chain?of?calls?of?C?functions?in?coerce.c?for?as.character(<logical>)?in?R:
do_asatomic
ascommon
coerceVector
coerceToString
StringFromLogical?(for?each?element)
The?definition?of?'StringFromLogical'?in?coerce.c?:
attribute_hidden?SEXP?StringFromLogical(int?x,?int?*warn)
{
????int?w;
????formatLogical(&x,?1,?&w);
????if?(x?==?NA_LOGICAL)?return?NA_STRING;
2025 Feb 03
1
boolean and logical types -draft
Tomas,
I am thinking of writing something for R-devel, and hope to have your
input first.
I get moderated on R-devel as I am now subscribed as
brian.ripley at R-project.org which of course I cannot send from. So I am
even more discouraged from posting there. (R-core is bad enough with
Luke discouraging all innovation except by him and Simon completely
misunderstanding the C23 status.)
2015 Sep 20
2
Long vectors: Missing values and R_xlen_t?
Is there a missing value constant defined for R_xlen_t, cf. NA_INTEGER
(== R_NaInt == INT_MIN) for int(eger)? If not, is it correct to
assume that missing values should be taken care/tested for before
coercing from int or double?
Thank you,
Henrik
2010 Jun 19
1
more powerful iconv
R community,
As you may know, R's iconv doesn't work well converting to and from
encodings that allow embedded nulls. For example
> iconv("foo", to="UTF-16")
Error in iconv("foo", to = "UTF-16") :
embedded nul in string: '\xff\xfef\0o\0o\0'
However, I don't believe embedded nulls are at issue here, but rather
that R's iconv
2005 Nov 18
1
using a factor as col argument in plot:
Dear R core team
Using the following code produces an empty plot (similar
to col = NA):
> plot(1:9, col = factor(rep(1:3,3), labels = c("red", "blue", "black")))
My question: Shouldn't one get at least a warning (or an error)
if one tries to use a factor as col argument?
Thanks for an answer.
Regards,
Christoph Buser
2011 Aug 29
3
How to safely using OpenMP pragma inside a .C() function?
I am trying to parallelize part of a C function that is called from R (via
.C) using OpenMP's "parallel for" pragma. I get mixed results: some runs
finish with no problem, but some lead to R crashing after issuing a long
error message involving memory violations.
I found this post, which describes how a .Call() function can be made to
avoid crashing R by raising the stack limit:
2019 Sep 03
2
[ALTREP] What is the meaning of the return value of Is_sorted and No_NA function?
Hi,
I would like to figure out the meaning of the return value of these two
functions. Here are the default definitions I find from R source code:
static int altreal_Is_sorted_default(SEXP x) { return UNKNOWN_SORTEDNESS; }
static int altreal_No_NA_default(SEXP x) { return 0; }
I guess the macro *UNKNOWN_SORTEDNESS *in *Is_sorted* and 0 in *No_NA
*simply means
unknown sorted/NA status of
2003 May 02
2
Suppressing Scientific Notation
R gurus,
Every so often(*) someone asks how to suppress scientific notation in
printing, so I thought I'd give it a shot, but I need some help.
The formatting decision is made(**) on line 286 of src/main/format.c :
if (mF <= *m) { /* IFF it needs less space : "F" (Fixpoint) format */
where mF is the number of characters for "normal" printing and *m is the number
2004 Apr 29
0
Pxelinux/memdisk with Universal TCP/IP Network Bootdisk floppy
Just for the record, I want to let the list know that I succeeded in
booting a modified Universal TCP/IP Network Bootdisk floppy from
http://members.iinet.net.au/~bdriver/bootdisk/
I started with a Win98 Bootfloppy from http://www.tobs.uku.co.uk.
Then I made a disk image from this, using dd.exe from cygwin.
Then I converted this disk image from 1.44MB to 2.88MB with winimage.
Then I copied
2019 Jan 12
0
samba.service is masked (Debian 9)
On Sat, 12 Jan 2019 22:04:50 +0100
Anton Blau via samba <samba at lists.samba.org> wrote:
> Hello,
>
> please excuse my bad english. But I am not a native speaker.
>
> I installed samba 4 (DC) like this description
> http://tobs.tips/_doc_/ProxMoxDoc/07samba/ on a new Debian 9 System.
>
> After
>
> * apt-get install samba
>
> * service samba stop