Displaying 20 results from an estimated 800 matches similar to: "shash in unique.c"
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
2007 Jul 23
1
CHAR(STRING_ELT( - OK but CHAR(asChar(STRING_ELT( - not, why?
Any idea why CHAR(asChar(STRING_ELT( produces NA whereas
CHAR(STRING_ELT( gets a pointer to a string? It's generally expected
that STRING_ELT should already be a character, but why the coercion does
not work? Here is a simple example (consistent over R2.5.1-R2.6 rev
42284, I didn't check earlier versions, but it used to be different in
2.4):
install.packages("inline")
2007 Sep 13
1
chartr better
For example, the following changes are necessary when i convert a
Japanese hiragana into katakana in chattr.
R code:
> chartr("\u3041-\u3093","\u30a1-\u30f3","\u3084\u3063\u305f\u30fc")
--- R-alpha.orig/src/main/character.c 2007-09-05 07:13:27.000000000 +0900
+++ R-alpha/src/main/character.c 2007-09-13 16:10:21.000000000 +0900
@@ -2041,6 +2041,16 @@
2002 Aug 13
2
Misalignment of <NA> in rownames (PR#1905)
An NA in the rownames of a matrix (or dataframe) causes misalignment when the
matrix is printed:
R> x <- matrix(1:12, 3,4, dimnames=list(letters[1:3], LETTERS[1:4]))
R> rownames(x)[2] <- NA
R> x
A B C D
a 1 4 7 10
<NA> 2 5 8 11
c 3 6 9 12
The bug is in function Rstrlen, in src/main/printutils.c. MatrixRowLabel and
MatrixColumnLabel (same file) rely on Rstrlen
2014 Mar 26
1
internal string comparison (Scollate)
Hello,
I?d like to compare two strings internally the way R would, so I need Scollate which is not part of the authorized R api.
So:
- Can Scollate (and perhaps Seql) be promoted to api ?
- If not what are the alternatives ? Using strcmp or stroll does not seem as general as Scollate.
Romain
PS: Here is some context: https://github.com/hadley/dplyr/issues/325
2006 Jun 22
2
.Call and data frames
Hello,
I'm trying to fetch a data frame through the C API,
and have no problem doing this when all columns
are numbers, but when there is a column of
strings I have a problem. On the C-side the
function looks like:
SEXP myfunc(SEXP df),
and it is called with a dataframe from
the R side with:
.Call("myfunc", somedataframe)
On the C side (actually C++ side) I use code
like this:
2005 Jan 24
1
sprintf("%s\n", a) segfaults R with big a (PR#7554)
Full_Name: Webb S.
Version: 2.0.1
OS: Linux Debian
Submission from: (NULL) (199.174.209.10)
Transcript:
> b = 'a small string'
> sprintf('foo: %s\n', b)
[1] "foo: a small string\n"
> a = matrix (ncol=100, nrow=1000, data=c(1,2,3,4,5))
> a.serial = serialize(a, NULL, ascii=TRUE)
> sprintf('foo: %s\n', a.serial)
Segmentation fault
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
2003 Dec 17
1
Accessing row and col names of SEXP objects
Can someone lend me a hand with extracting the dimnames from a SEXP? I've
looked through R-exts, but I couldn't find an example.
Here is the code I'm using to grab the jth column name and print it, but the
colnames I'm getting are garbage.
None of the following are working.
void printInfo(SEXP ts) {
int j;
for (j=0; j<col; j++) {
2007 Feb 20
2
Problem with types on 64-bit
Hi Everyone,
I have a problem using some working 32-bit R code with 64-bit machine ( I am
using version R-2.4.1 ). The problem occurs when I am trying to detect a NULL
STRSXP type. ( Perhaps I am doing this detection in the wrong way? )
On 32-bit the following works, and correctly identifies if I am passing NULL
or a valid string object:
if ( v_dta_start != R_NilValue && STRING_ELT(
2007 Sep 28
1
CHAR () and Rmpi
Hi. I am the maintainer of Rmpi package. Now I have a problem regarding
the change of CHAR () in R 2.6.0. According to R 2.6.0 NEWS:
*******
CHAR() now returns (const char *) since CHARSXPs should no
longer be modified in place. This change allows compilers to
warn or error about improper modification. Thanks to Herve
Pages for the suggestion.
*******
Unfortunately this
2012 Dec 08
2
file.link on Windows 7
Hello,
A post to R-Help by Oliver Soong reports what seems to be a bug specific
to Windows (I'm on Windows 7).
The original post is as follows:
----------------------------------------------------------------
from: Oliver Soong <osoong+r at gmail.com>
to: r-help <r-help at r-project.org>
date: Fri, 7 Dec 2012 22:07:49 -0800
subject: [R] file.link fails on NTFS
Windows 7 64-bit,
2011 Oct 05
1
unique possible bug
Hi,
I am trying to read in a rather large list of transactions using the
arules library. It seems in the coerce method into the dgCmatrix, it
somewhere calls unique. Unique.c throws an error when n > 536870912;
however, when 4*n was modified to 2*n in 2004, the overflow protection
should have changed from 2^29 to 2^30, right? If so, how would I
change it in my copy? Do I have to recompile
2012 Aug 10
3
Vector size limit for table() in R-2.15.1
Hi,
First, thanks in advance. Some useful info:
>version
platform x86_64-unknown-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
version.string R version 2.15.1 (2012-06-22)
I'm trying to use the table() function on a 2 column matrix that has 711
million rows (see below). However, it freezes. If I subset the matrix to be
less than or equal
2000 Aug 09
2
GenGC changes
As most R developers maybe are already aware of, R version 1.2.0
introduced a new `generational' garbage collector which means that
strings and vectors (and language objects) are handled differently from
the numerical atomic types.
>From ``Writing R Extensions'':
Earlier code was written in a style like.
VECTOR(dimnames)[0] = getAttrib(x, R_NamesSymbol);
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
2013 Jan 11
1
Patch for setwd() to show path in error message
Below is a patch for setwd() to show path in error message. Current
it just gives error messages such as:
Error in setwd(libdir) : cannot change working directory
with the patch it should (read untested) give:
Error in setwd(libdir) : cannot change working directory to 'path/that/fails/'
PATCH:
% diff -u util.c "util,patch.c"
--- util.c 2012-12-16 13:13:05.002249900
2009 Jan 05
1
can't get names of R_env
Hi,
I'm quite knew in R, so I might not have the R specific jargon.
But here is my problem,
I'm trying to access and use variabels given by a function environment,
more specifically the rho in do_optim in src/main/optim.c
According to the documentation
http://cran.r-project.org/doc/manuals/R-ints.html#The-_0027data_0027
the envsxp is defined as a tagged pairlist.
"ENVSXP: Pointers
2006 Oct 17
1
Error: STRING_ELT() can only be applied to a 'character vector', not a 'builtin'
I have a daily job that attaches hundreds of pseudo-packages containing
data as promise objects (DDP's, ref: g.data package), and plots the
results to a multi-page pdf device. Sometimes it fails. Under R-2.2.1
it just gave segfaults. Under R-2.3.1 it gave this error message:
*** caught segfault ***
address (nil), cause 'memory not mapped'
Traceback:
1:
2004 Nov 29
1
data is getting corrupted
I've been attempting to perform some analysis on a model that was
interfaced with R (R calls a library that takes SEXPs and converts the
data frames into the internal structures of data), and I notice that for
small data.frames the vectors don't get corrupt (n<200-ish). When I pass
in larger data.frames, the vectors will become corrupt. I've been
PROTECTING the heck out of