Displaying 20 results from an estimated 200 matches similar to: "bug or correct behaviour ?"
2012 Jan 25
4
formula error inside function
I want use survfit() and basehaz() inside a function, but it doesn't work.
Could you take a look at this problem. Thanks for your help. Following is my
codes:
library(survival)
n <- 50 # total sample size
nclust <- 5 # number of clusters
clusters <- rep(1:nclust,each=n/nclust)
beta0 <- c(1,2)
set.seed(13)
#generate phmm data set
Z <- cbind(Z1=sample(0:1,n,replace=TRUE),
2008 May 23
1
Shared Library Error
Can anyone help me resolve this? A part of the R function looks like this:
print(is.loaded('merge_xtabs_patterns_file'))
print(is.loaded('merge_xtabs_patterns_file_'))
.Fortran('merge_xtabs_patterns_file_',ydim[1],ydim[2],x=as.integer(as.matrix(y)),na=as.integer(c),
maxD=as.integer(maxD),lrowmem=length(rowmem),rowmem=as.integer(rowmem),
2010 Jan 11
1
K-means recluster data with given cluster centers
K-means recluster data with given cluster centers
Dear R user,
I have several large data sets. Over time additional new data sets will be created.
I want to cluster all the data in a similar/ identical way with the k-means algorithm.
With the first data set I will find my cluster centers and save the cluster centers to a file [1].
This first data set is huge, it is guarantied that cluster
2006 Jul 11
2
Converting SEXP to primitive C types
I'm new to R development, so this may be a trivial question.
In C, How do you convert a SEXP value returned by an R function to a
primitive C type (int, double, char, array, etc.)? I've tried using
the INTEGER(x), VECTOR_ELT(x,i), and similar functions found in /src/
include/Rinternals.h, but doing so results in incorrect results or a
seg-fault.
For example, I modified
2001 Feb 28
2
Automating the job?
Hi!
I just started to use R recently, and would like to ask a help about
automating the job.
I need to use "kmeans" function with my own 300 data files, and wonder if
it's possible to do it automatically. For example,
> library (mva)
> mydata <- read.table ("data1")
> cl <- kmeans(mydata, 5, 20)
and I just need to save "cl" info (i.e. the center
2007 May 14
1
Best Practise
Hello,
Just a quick question on best practise. I am converting quite a bit of
legacy C code into R packages and have the following situation:
(1) Legacy object with a double* array in, all over code so don't want to
change any more than I have to.
(2) Do something like:
SEXP arrayToPassToR;
PROTECT( arrayToPassToR = allocVector( REALSXP, n ) );
for(i=0; i < n; i++) {
2006 May 25
1
compiling tests/Embedding
I am compiling the Embedding examples in the tests directory and get an
undefined reference. I include the make output as well as grep'd output
of nm on libR.so and compiler and arch information. Do I have an
improperly built R shared library or is there a problem with the
Embedding tests or something else I am not seeing?
Thanks for any help!
George
ost at
2006 Mar 17
1
Neyman-Scott cluster process
Hi there,
I want to generate a random point pattern using the Neyman-Scott
cluster process using spatstat package in R. After running the
following procedures, why i can not see any figures?
> nclust <- function(x0, y0, radius, n) {return(runifdisc(n, radius, x0, y0))}
> nclust
function(x0, y0, radius, n) {return(runifdisc(n, radius, x0, y0))}
> X <- rNeymanScott(10, 0.2, nclust,
2006 Apr 17
0
pre compiled gnu scientific library for win one-click-installer
hi all-
after a but of hacking with msys and mingw i think i''ve compiled an easy to
install version of the rb-gsl bindings. for those of you who don''t know what
these are, the gnu scientific library (gsl) is by far the best collection of
open source algorithms for scientific computing available. you can read about
the gsl and ruby bindings to it here
2001 Feb 27
1
using fmod in C code to be loaded into R
Dear People,
I wrote the following bit of C code and (along with other bits) called it
mycode.c, and compiled the file into a shared library to load into R,
using R CMD SHLIB mycode.c. This was Ok, but when I tried to load this
into R using dyn.load("mycode.so") I got the error
> dyn.load("mycode.so")
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to
2004 Sep 12
0
Help needed: division by zero in winword etc.
Hi, in quite a few programs i can not browse the
filesystem when opening a "listbox"; to be more clear:
for example when i do in winword Open and the listbox
appears, and i try to open the pull down menu winword
just quits(without an error message in wine). In
another program like "Camel join" it quits as soon as
i go up to the level of "my computer" with a message
2001 Dec 10
1
Validchars / spanish not working
Hi everybody, I need your help, I installed samba on a small network in
Mexico, there are many many file names in spanish so I put these lines
to my smb.conf
client code page = 437
valid chars = E1 E9 ED F3 FA
I looked for the hex values of the accented lower case vocals, thats
where E1, E9, etc came from
Something weird happens, even when the Folder/file names are listed
correctly (with
2005 Feb 04
5
simple example of C interface to R
i'd like to use the C interface to R in a program i'm writing. as a
starting point, i'm trying to create a very simple C program that uses
R. i've read the R documentation on this, but i'm having trouble
figuring out where SEXP is defined and how to use it.
i noticed someone else on this list also tried to use the C interface,
but they ran into similar problems:
2002 Oct 23
0
Obtaining covariance matrices for kmeans output clusters
I am having trouble getting a covariance matrix for each cluster which
is output by kmeans(). My input looks like:
> imagedat <- read.table("table", header=TRUE)
> imagedat
Red Green Blue
0_0 5 7 8
1_0 5 5 18
2_0 7 8 49
3_0 22 8 76
4_0 54 10 67
5_0 50 9 28
6_0 18 10 15
7_0 9 7 6
2005 Oct 26
2
changing memory limits to speed up lsoda
Hi All,
I am running R 2.2.0 on Mac OS 10.4.2, dual G5 processors with 8 Gig
RAM.
I am running a simulation with lsoda that requires ~378 s to complete
one set of time intervals. I need to optimize the parameters, and so
need to considerably speed up the simulation.
I have tried to figure out how to change the appropriate memory
allocation and have search R help and Introductory
2007 Mar 27
3
Use of 'defineVar' and 'install' in .Call
Dear all,
[system and version information below]
I am trying to modify a C function for finding the root of an
expression. The function is to be called from R as .Call with input
parameters:
f: expression for which we will find the root
guesses: interval for the solution
stol: tolerance
rho: environment
The original functions I use are:
SEXP mkans(double x) {
SEXP ans;
PROTECT(ans =
2007 Mar 27
3
Use of 'defineVar' and 'install' in .Call
Dear all,
[system and version information below]
I am trying to modify a C function for finding the root of an
expression. The function is to be called from R as .Call with input
parameters:
f: expression for which we will find the root
guesses: interval for the solution
stol: tolerance
rho: environment
The original functions I use are:
SEXP mkans(double x) {
SEXP ans;
PROTECT(ans =
2005 Jun 24
3
Counterpart for Matlab's 'feval'?
Hi!
I've just begun writing a program that searches for the minimum of a
function with golden section search. In order to do this in a nice way I
need a function that takes a function name and an argument and returns the
function value for that argument, i .e just like Matlab's 'feval'. Is
there any?
Thanks before hand!
Best regards,
Fredrik Thuring, Codan Insurance A/S
2004 Jan 30
1
MATLAB to R
Ladies and Gentlemen,
In MATLAB, I can write:
for J=1:M
Y(J+1)=Y(J)+ h * feval(f,T(J),Y(J));
...
In R, I can write above as:
for (J in 2:M)
{
y = y + h * f(t,y)
...
}
----
In MATLAB, I can write:
for J=1:M
k1 = feval(f,T(J),Y(J));
k2 = feval(f,T(J+1),Y(J)+ h * k1
How do I write k2 in R?
k1 = f(t,y)
k2 = ?
Thanks,
/oal
2011 Aug 15
0
Stopping criterion in option "control" of BBsolve( )
Dear Dr. Gilbert, Dr. Varadhan and all R-help list members,
I'm using the function BBsolve( ) and I have some questions on the stopping
criterion "maxit" and "noimp" specified in the option "control". Here
are two such examples I'm having problem with. In these two examples, the
function BBsolve( ) always stops at iteration 100, overlooking the values