Displaying 20 results from an estimated 300 matches similar to: "Accuracy: Correct sums in rowSums(), colSums() (PR#6196)"
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:
2007 Dec 06
5
Help rewriting looping structure?
Hey Folks,
Could somebody help me rewrite the following code?
I am looping through all records across 5 fields to calculate the cumulative
percentage of each record (relative to each individual field).
Is there a way to rewrite it so I don't have to loop through each individual
record?
##### tdat is my data frame
##### j is my field index
##### k is my record index
##### tsum is the sum of
2012 Mar 09
2
Create a list object in a loop
Dear all,
I'm trying to create a list of point patterns ppp.object {spatstat} in a loop.
My dataset looks like this:
> names(OT1);head(OT1);dim(OT1)
[1] "EID" "latitude" "longitude" "month" "year" "CPUE" "TSUM"
[8] "fTSUM"
EID latitude longitude
2023 May 06
1
Change DEFAULTDEPARSE to DEFAULTDEPARSE | SHOWATTRIBUTES ?
The deparse options used by default by 'deparse' and 'dput' are
c("keepNA", "keepInteger", "niceNames", "showAttributes")
but Defn.h still has
#define DEFAULTDEPARSE 1089 /* KEEPINTEGER | KEEPNA | NICE_NAMES, used for
calls */
i.e., with the SHOWATTRIBUTES bit turned off. Is that on purpose?
Note that this leads to weird
2002 Aug 07
1
Change in NA_REAL behavior (PR#1886)
Full_Name: David Larsen
Version: 1.5.1
OS: Redhat 7.2, w98, w2000
Submission from: (NULL) (128.206.66.65)
I have c code that produces vector sequences for plotting. I use NA_REAL to
create an NA that will pass back to R to break the line. This code worked fine
upto R-1.5.0 It continues to work on Redhat7.2 Linux but on both windows98 and
windows2000 the NA_REAL returns -6.623485e-229 on both
2001 Nov 05
1
Setting NA from C code
In the maps library, NA's are inserted between polygons so lines() can
be used to draw all polygons at once. The code to do it is like this:
*x++ = NA_REAL;
*y++ = NA_REAL;
where x and y are declared as
double *x, *y, *range;
and are the arguments passed in through a .C call.
However, the values show up in R as -6.62314033633867e-229 instead of
NA, so the
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
2015 Apr 24
2
Development version of R: Improved nchar(), nzchar() but changed API
Those of you who track R development closely,
will have noticed yesterday's commit of enhanced versions of
nchar() and nzchar().
------------------------------------------------------------------------
r68254 | maechler | 2015-04-23 18:06:37 +0200 (Thu, 23 Apr 2015) | 1 line
Changed paths:
M doc/NEWS.Rd
M src/library/base/R/New-Internal.R
M src/library/base/R/zzz.R
M
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
2024 Oct 08
1
WRE about R_strtod
Hello,
This is what "Writing R extensions" currently says about R_atof and
R_strtod:
>> Function: void R_atof (const char* str)
>> Function: void R_strtod (const char* str, char ** end)
>>
>> Implementations of the C99/POSIX functions atof and strtod which
>> guarantee platform-dependent behaviour, including always using the
>> period as the decimal
2001 Apr 09
1
syntax error in datetime.c (PR#901)
Full_Name: Naoki Takebayashi
Version: 1.2.2
OS: Linux, RedHat 7.0/alpha
Submission from: (NULL) (152.3.12.123)
With RedHat 7.0/alpha (gcc 2.96-69), I encountered following error:
gcc -I. -I../../src/include -I../../src/include -I/usr/local/include
-DHAVE_CONFIG_H -mieee -O2 -mieee -c datetime.c -o datetime.o
datetime.c: In function `do_systime':
datetime.c:306: parse error before `ans'
2012 Sep 20
3
(no subject)
>From my book on corpus linguistics with R:
# (10) Imagine you have two vectors a and b such that
a<-c("d", "d", "j", "f", "e", "g", "f", "f", "i", "g")
b<-c("a", "g", "d", "f", "g", "a", "f", "a",
2010 Sep 08
0
Correction to vec-subset speed patch
I found a bug in one of the fourteen speed patches I posted, namely in
patch-vec-subset. I've fixed this (I now see one does need to
duplicate index vectors sometimes, though one can avoid it most of the
time). I also split this patch in two, since it really has two
different and independent parts. The patch-vec-subset patch now has
only some straightforward (locally-checkable) speedups for
2015 Apr 27
1
Development version of R: Improved nchar(), nzchar() but changed API
Dear Martin,
Does the work on nchar mean that bugs #16090 and #16091 will be resolved
[1,2]?
Thanks,
Mark
[1] https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16090
[2] https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16091
On Sat, Apr 25, 2015 at 11:06 PM, James Cloos <cloos at jhcloos.com> wrote:
> >>>>> "GC" == G?bor Cs?rdi <csardi.gabor at
2017 Oct 09
1
Using response variable in interaction as explanatory variable in glm crashes R
>>>>> Jan van der Laan <rhelp at eoos.dds.nl>
>>>>> on Fri, 6 Oct 2017 12:13:39 +0200 writes:
> It is actually model.matrix that crashes, not glm. Same
> crash occurs with e.g. lm.
> model.matrix(dob_mon ~ dob_day*dob_mon, data = tab)
> also crashes R.
Yes, segmentation fault.
It only happens when these are *logical*
2002 Oct 21
1
dist() {"mva" package} bug: treats +/- Inf as NA
Vince Carey found this (thank you!).
Since the fix to the problem is not entirely obvious, I post
this to R-devel as RFC:
help(dist) says:
>> Missing values are allowed, and are excluded from all computations
>> involving the rows within which they occur. If some columns are
>> excluded in calculating a Euclidean, Manhattan or Canberra
>> distance, the sum is
2023 Nov 06
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
Hmm, it is not actually at odds with help(c), it is just that the autocoercion works different that it used to, so that
as.complex(NA) == as.complex(NA_real) == NA_real_+0i)
which now differs from
NA_complex
although both print as NA.
I haven't been quite alert when this change was discussed, but it does look a bit unfortunate that usage patterns like c(NA, 0+1i) does not give complex NA
2018 Mar 21
3
Sum of columns of a data frame equal to NA when all the elements are NA
What do you mean by "should not"?
NULL means "missing object" in R. The result of the sum function is always expected to be numeric... so NA_real or NA_integer could make sense as possible return values. But you cannot compute on NULL so no, that doesn't work.
See the note under the "Value" section of ?sum as to why zero is returned when all inputs are removed.
2009 Feb 27
0
POSIXlt, POSIXct, strptime, GMT and 1969-12-31 23:59:59
R-devel:
Some very inconsistent behavior, that I can't seem to find documented.
Sys.setenv(TZ="GMT")
str(unclass(strptime("1969-12-31 23:59:59","%Y-%m-%d %H:%M:%S")))
List of 9
$ sec : num 59
$ min : int 59
$ hour : int 23
$ mday : int 31
$ mon : int 11
$ year : int 69
$ wday : int 3
$ yday : int 364
$ isdst: int 0
- attr(*, "tzone")= chr
2007 Feb 08
3
Get categories where forum-user posted in
I''m developing a system similar to the ForumExample (http://
wiki.rubyonrails.org/rails/pages/ForumExample), and stumbled upon the
following.
Let''s say I wanted to get all the categories a certain user posted in.
How do I get that information withouth using a custom query
through :finder_sql (and thus losing the find_in_collection ownage)?
It would also be great to see how many