Displaying 20 results from an estimated 4000 matches similar to: "Help: Using R from C"
2001 Nov 28
2
shell()/system() question
Hi folks:
How do I get shell() or system() to run external programs in a particular
directory (different from the current R working directory)?
> version
_
platform i386-pc-mingw32
arch x86
os Win32
system x86, Win32
status
major 1
minor 3.0
year 2001
month 06
2001 May 14
0
followup: lookup function for density(...) objects
Thanks to Ross Ihaka and Bob Wheeler for responding to my earlier question. I
looked into the Johnson system functions in SuppDists package. For now, I want
to stick with the density(...) estimator, and so still need the variate lookup
function.
As per Ross' suggestion, I just did a numerical integration on the density
object and used approxfun/splinefun to "lookup" the variate
2002 Mar 05
3
reading 2-byte integers using readBin and connections
Hi folks:
This may be a stupid question, but I cannot seem to find a way to tell
readBin that I want to read 2-byte integers from the connection. The input
file is 150,720 bytes long containing 75,360 short (2-byte) integers. But
specifying "integer" or "int" for what in readBin only returns me a vector
of length 37680, leading me to believe that sizeof(integer) or
2003 Jan 29
1
dyn.load warning message in R1.6.2 on Windows XP
Hi folks:
I used to load a DLL fine up until R 1.5.1. The same DLL dyn.loaded under R
1.6.2 prints the following warning message:
> dyn.load("C:/Rajiv/Bin/rpdate.dll")
Warning message:
DLL attempted to change FPU control word from 8001f to 9001f
>
Any indication as to what the warning means, and whether I should be
concerned about it? The DLL is made from a pure C code,
2004 Oct 17
2
Re: [R] Problem Compiling R-2.0.0 on Linux Alpha
Thanks, Peter, and Prof. Ripley.
My efforts last night was mostly futile except that it told me about the
embedded newline in Built field.
Prof. Ripley: how do I get your fixes? Can I just download
R-2.0.0-patched?
Rajiv
--------
Rajiv Prasad
Scientist, Hydrology Group
Pacific Northwest National Laboratory, P.O. Box 999, MSIN K9-33
Richland, WA 99352
Voice: (509) 375-2096 Fax: (509) 372-6089
2002 Aug 26
5
updating n within for(i in 1:n) loop
Hi folks:
I think I'm having problems with figuring this one out:
test1 <- function()
{
n <- 2
for(i in 1:n)
{
cat(paste("i =", i, "\n")); flush.console()
n <- 5 # version 1
#n <<- 5 # version 2
#assign("n", 5, envir = environment(test1)) # version 3
}
}
I need the for(.) loop to run (say) n=5 times within the
2001 Nov 28
1
fill patterns
Hi folks:
Any idea when the density and angle arguments to polygon() are to be
implemented? Or is there another way to achieve hatching fill patterns?
TIA.
Rajiv.
--------
Rajiv Prasad
Postdoctoral Research Associate, Hydrology Group
Pacific Northwest National Laboratory, P.O. Box 999, MSIN K9-33
Richland, WA 99352
Voice: (509) 375-2096 Fax: (509) 372-6089 Email: rajiv.prasad at pnl.gov
2004 Oct 16
3
Problem Compiling R-2.0.0 on Linux Alpha
Hi folks:
I'm trying to compile R-2.0.0 on my Alpha (164SX;
alphapca56-unknown-linux-gnu) running RedHat Linux 7.2 with gcc3.4.1.
Here is where the compile terminates:
....
....
building package 'tcltk'
mkdir -p -- ../../../library/tcltk/R
mkdir -p -- ../../../library/tcltk/demo
mkdir -p -- ../../../library/tcltk/exec
mkdir -p -- ../../../library/tcltk/man
make[4]: Entering directory
2004 Oct 16
3
Problem Compiling R-2.0.0 on Linux Alpha
Hi folks:
I'm trying to compile R-2.0.0 on my Alpha (164SX;
alphapca56-unknown-linux-gnu) running RedHat Linux 7.2 with gcc3.4.1.
Here is where the compile terminates:
....
....
building package 'tcltk'
mkdir -p -- ../../../library/tcltk/R
mkdir -p -- ../../../library/tcltk/demo
mkdir -p -- ../../../library/tcltk/exec
mkdir -p -- ../../../library/tcltk/man
make[4]: Entering directory
2001 May 10
3
lookup function for density(...) objects
Hi folks:
Is there a lookup function that returns the variate given the cumulative
probability for an object returned by the density(...) function?
> mydata _ as.vector(mymatrix)
> mydata.density _ density(mydata)
> mydata.p80 _ lookup(mydata.density, p=0.8) # is there any function to
accomplish this task?
Thanks.
Rajiv.
--------
Rajiv Prasad, Postdoctoral Research Associate,
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
2013 Apr 01
2
Timing of SET_VECTOR_ELT
Assume a C program invoked by .Call, that returns a list.
Near the top of the program we allocate space for all the list elements. (It is my habit
to use "xyz2" for the name of the R object and "xyz" for the pointer to its contents.)
PROTECT(means2 = allocVector(REALSXP, nvar));
means = REAL(means2);
PROTECT(u2 = allocVector(REALSXP, nvar));
u =
2004 Oct 18
0
Re: [R] Problem Compiling R-2.0.0 on Linux Alpha
Thanks, Prof. Ripley. I downloaded the new admin.R and used that in
place of one in R-2.0.0 build directory. The compile went fine. So,
for the record, R-2.0.0 + Prof. Ripley's fixed admin.R compiles fine on
"alphapca56-unknown-linux-gnu".
----
[rajiv@localhost rajiv]$ R
R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.0 (2004-10-04), ISBN
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));
2011 Jan 17
1
isoreg memory leak?
I believe there is a memory leak in isoreg in the current version of R,
as I believe the following shows
> gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 120405 3.3 350000 9.4 350000 9.4
Vcells 78639 0.6 786432 6.0 392463 3.0
> for(k in 1:100) {
+
+ y <- runif(10000)
+ isoreg(x,y)
+ }
> rm(x)
> rm(y)
> gc()
used (Mb) gc
2013 Jul 13
2
missing PROTECT() in src/main/arithmetic.c
at lines 651 & 653 (integer_binary function):
if (code == DIVOP || code == POWOP)
ans = allocVector(REALSXP, n);
else
ans = allocVector(INTSXP, n);
There are calls to warningcall() later in the function, which can
trigger garbbage collection.
Looks like the typical scenario where it seemed pretty safe to not
PROTECT in the original version of the function but
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
2018 Feb 02
1
R-gui sessions end when executing C-code
Hi
I'm trying to develop some C code to find the fixpoint of a contraction mapping, the code compiles and gives the right results when executed in R.
However R-gui session is frequently terminated. I'm suspecting some access violation error due to the exception code 0xc0000005
In the error report windows 10 gives me.
It is the first time I'm writing any C-code so I'm guessing I
2008 Apr 05
2
Adding a Matrix Exponentiation Operator
Hi all
I recently started to write a matrix exponentiation operator for R (by
adding a new operator definition to names.c, and adding the following code
to arrays.c). It is not finished yet, but I would like to solicit some
comments, as there are a few areas of R's internals that I am still feeling
my way around.
Firstly:
1) Would there be interest in adding a new operator %^% that performs
2011 Oct 24
2
C function is wrong under Windows 7
Dear mailing list,
I have a C function that gives me a wrong result when I run it under Windows
7.
This is the code under Linux (RHEL5):
> library(phenoTest)
> data(epheno)
> sign <- sample(featureNames(epheno))[1:20]
> score <- getFc(epheno)[,1]
> head(score)
1007_s_at 1053_at 117_at 121_at 1255_g_at 1294_at
-1.183019 1.113544 1.186186 -1.034779 -1.044456