Displaying 20 results from an estimated 1000 matches similar to: "Convert multiple C strings into an R character vector"
2004 Mar 17
1
best methods for strings and structures?
I'm trying to generate an R interface for a library that's commonly used and
I'm currently writing wrapper functions for file i/o and return an object
(list?) that contains the elements of the C structure. For example, reading
a file that contains:
struct CONFIG_RECORD
{
char coeffs_filename[256];
char species_filename[256];
unsigned long
2013 Jun 27
3
Read a text file into R with .Call()
Hi,
I want to read a text file into R with .Call().
So I define some NEW_CHARACTER() to store the chracters read and use SET_STRING_ELT to fill the elements.
e.g.
PROTECT(qNames = NEW_CHARACTER(10000));
char *foo; // This foo holds the string I want.
while(foo = readLine(FN)){
SET_STRING_ELT(qNames, i, mkChar(foo)));
}
In this way, I can get the desired character from qNames. The only problem
2007 Jul 21
2
dict package: dictionary data structure for R
Hi all,
The dict package provides a dictionary (hashtable) data
structure much like R's built-in environment objects, but with the
following differences:
- The Dict class can be subclassed.
- Four different hashing functions are implemented and the user can
specify which to use when creating an instance.
I'm sending this here as opposed to R-packages because this package
will
2004 Jun 14
5
mkChar can be interrupted
Hi,
As was discussed earlier in another thread and as documented in R-exts
.Call() should not be interruptible by Ctrl-C. However the following
code, which spends most of its time inside mkChar, turned out to be
interruptible on RH-7.3 R-1.8.1 gcc-2.96:
#include <Rinternals.h>
#include <R.h>
SEXP foo0(const SEXP nSexp) {
int i, n;
SEXP resSexp;
if (!isInteger(nSexp))
2015 Dec 07
2
inconsistency in POSIXlt
The documentation for the POSIXlt class states '"POSIXlt" objects will
often have an attribute "tzone", a character vector of length 3 giving the
time zone name from the TZ environment variable and the names of the base
time zone and the alternate (daylight-saving) time zone. Sometimes this may
just be of length one, giving the time zone
2003 Sep 05
1
Problem with S4 slots in C code (PR#4073)
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C3738F.63DE3390
Content-Type: text/plain;
charset="iso-8859-1"
#I want to be able to create a new S4 class and read data into it using C
code
# Here is a very simple S4 object inheriting from "array", but with 5
2006 Nov 17
1
Manipulating R lists in C
Hi,
I have been studying the R manual on lists but cannot seem to create a
simple R list in C - I keep on getting "'dimnames' applied to non-array"
whenever I attempt to assign names to the list elements:
Wanted output a list structure something like
[ type="Bid", price=2.0, volume=1000 ]
I can get up to a list of
[ "Bid2, 2.0, 1000 ]
But for the life of
2016 Oct 24
3
typo or stale info in qr man
man for `qr` says that the function uses LINPACK's DQRDC, while it in
fact uses DQRDC2.
```
The QR decomposition of the matrix as computed by LINPACK or LAPACK.
The components in the returned value correspond directly to the values
returned by DQRDC/DGEQP3/ZGEQP3
```
2008 Oct 28
2
A question about the API mkchar()
Hi guys,
I've got a question about the API mkchar(). I have met some difficulty
in parsing utf-8 string to mkchar() in R-2.7.0.
I was intending to parse an utf-8 string str_jan (some Japanese
characters such as?, whose utf-8 code is E381B5) to R API SEXP
mkChar(const char *name) , we only need to create the SEXP using the
string that we parsed.
Unfortunately, I found when parsing the
2002 Dec 18
2
meta analysis
Dear R-lister,
is there any function for Meta Analysis in R? (like homogeneity an, risk
differences, relative riskm amd odds ratios?
Many thanks,
Edwin
2014 Jun 26
1
using 2D array of SEXP for creating dataframe
Hi ,
For our production package i need to create a dataframein C . So I wrote
the following code
SEXP dfm ,head,df , dfint , dfStr,lsnm;
*SEXP valueVector[2];*
char *ab[3] = {"aa","vv","gy"};
int sn[3] ={99,89,12};
char *listnames[2] = {"int","string"};
int i,j;
//=============================
PROTECT(df = allocVector(VECSXP,2));
2010 Dec 23
2
python-like dictionary for R
Hi,
I was wondering if anyone has played around this this package called
"rdict"? It attempts to implement a hash table in R using skip lists. Just
came across it while trying to look for simpler text manipulation methods:
http://userprimary.net/posts/2010/05/29/rdict-skip-list-hash-table-for-R/
Cheers,
Paul
[[alternative HTML version deleted]]
2004 Jun 16
1
off topic: C/C++ codes for pseudo inverse
Hi,
I am looking for C/C++ codes for computing generalized
inverse of a matrix. Can anyone help me in this
regard?
Thanks,
Mahbub.
2014 Mar 06
1
Create dataframe in C from table and return to R
Hi ,
I am trying to create a dataframe in C and sebd it back to R. Can anyone
point me to the part of the source code where it is doing , let me explain
the problem I am having .
--------------------------------------------------------------------
My simple implementation is like this
SEXP formDF() {
SEXP dfm ,df , dfint , dfStr,lsnm;
char *ab[3] =
2008 Mar 17
1
Inconsistency in gsub in R.2.6.2 (PR#10978)
Hi,
May this be an oversight?
R version 2.6.2 Patched (2008-03-13 r44783)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
...
> x <- "ab?"
> Encoding(x)
[1] "latin1"
> Encoding(gsub("?","", x))
[1] "unknown"
> Encoding(gsub("?","", x, perl = TRUE))
[1] "latin1"
2005 Jul 15
3
Passing character strings from C code to R
Hi,
I have a C code which produces array of integers and potentially a string,
and I have problems passing the string out. Here is the relevant part of the
code:
1 PROTECT(Ret = allocVector(INTSXP, n));
2 ret = (int*) INTEGER(Ret); /* get pointer to R's Ret */
3 for(i=0; i<n; i++) ret[i] = data[i];
4 Free(data);
5 i=1;
6 if (comment) { // comment was found
7 n
2005 Jul 15
3
Passing character strings from C code to R
Hi,
I have a C code which produces array of integers and potentially a string,
and I have problems passing the string out. Here is the relevant part of the
code:
1 PROTECT(Ret = allocVector(INTSXP, n));
2 ret = (int*) INTEGER(Ret); /* get pointer to R's Ret */
3 for(i=0; i<n; i++) ret[i] = data[i];
4 Free(data);
5 i=1;
6 if (comment) { // comment was found
7 n
2008 Jan 31
1
segfault in gregexpr()
Hi,
Tried with R 2.6 and R 2.7:
> gregexpr("", "abc", fixed=TRUE)
*** caught segfault ***
address 0x1c09000, cause 'memory not mapped'
Traceback:
1: gregexpr("", "abc", fixed = TRUE)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
2008 Feb 21
1
Suggestion: isLoaded() to test if a package is loaded (without loading it)
Hi,
for 'affxparser' (Bioconductor), we needed a function to test if a
certain package was loaded or not, but we did not want to load it if
it wasn't, which is why we couldn't use require(). We came up with
the following solution:
isPackageLoaded <- function(package, version=NULL, ...) {
s <- search();
if (is.null(version)) {
s <-
2008 Jun 04
2
RSQLite bug fix for install with icc
Seth,
I encountered problems installing RSQLite, R-2.7.0, on RHEL4 using
Intel 10.1 icc, My sysadmin helped me track down the problem and
kindly forwarded me the fix, which corrected the problem.
What follows is from the sysadmin. Mark
I looked at the error, looks like there is a bug in the source code.
I've attached a new tarball, hopefully fixed.
I added
#include <sys/types.h>