Hi,
This question seems to be old, however I am asking it from a different point
of view.
R introduces itself as a 'statistical' language and environment. There are
many discussions about comparing R to MATLAB or mathematica (or other
similar software). It seems to me that these other
Hi,
I need to call a c funtion in R.I created the Dll in Visual C++.
And In R , I used the dyn(path) no erro.
Then when I call .c (function m=name , parameter) it always says
the c entry point product not in load table
I really need your help.
Many thanks
Gao
How are you running this 'script'?
If you use source(), you do need to explicitly print or use the
'print.eval' argument.
If you use R CMD BATCH or similar (which is what most people mean by
running a script), you do get autoprinting.
On Sun, 15 Oct 2006, Alexandre Aguiar wrote:
Hi,
I
See
?try
?tryCatch
FAQ 7.32
This is not a Windows/UNIX difference as you suppose, but an
interactive/batch difference. You could also look into using
options(error=).
On Sun, 15 Oct 2006, Toby Gardner wrote:
Dear R-users,
I have a frustrating problem that I am hoping has a simple fix.
Please, I would like to generate a random bistochastic matrix, that is a
squared matrix of non-negative numbers with each row and each column sum to
1, for example :
.2.3.5
.6.3.1
.2 .4 .4
I don't know of to code this. Do you have any idea ?
Thanks
Florent Bresson
Hello,
how can I best fill a (fixed) matrix with vectors of varying lengths by
column, setting the superfluous elements to zero? Here is my code:
v-(1,1,2,3,4,6)
binc-function(x){
l-sum(x)+1
y-c(1,rep(0,l-1))
for (i in x) y-y+c(rep(0,i),y)[1:l]
}
mat-matrix(0,
you can try something like the following:
out - lapply(1:length(v), function(i) binc(v[1:i]))
nout - max(sapply(out, length))
sapply(out, function(x) c(x, rep(0, nout - length(x
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public
for (i in 1:length(v)) {
bi - binc(v[1:i])
mat[1:length(bi),i]=mat[1:length(bi),i]+bi
}
On 16/10/06, Serguei Kaniovski [EMAIL PROTECTED] wrote:
Hello,
how can I best fill a (fixed) matrix with vectors of varying lengths by
column, setting the superfluous elements to zero? Here is
On Sat, 14 Oct 2006 23:00:27 +0100,
Mark Wardle (MW) wrote:
Hello all,
I've been able to use R very successfully to run simple statistics and
generate the plots I require.
I've been evaluating Sweave, and have hit upon a small problem that I
don't seem to be able to workaround.
On Sat, 14 Oct 2006 16:04:50 -0700,
Deepayan Sarkar (DS) wrote:
%.tex: %.Rnw
echo library(tools); Sweave('$') | ${R_PROG} --vanilla --silent
Note that we now have R CMD Sweave (new in R 2.4.0) for this purpose.
Best,
Fritz
__
Sorry, the plot_linetypes[1] is a debugging leftover.
It's plot_linetypes[graph_idx] in my actual code ...
And plot_linetypes is just the sequence 1,2,3,4... etc
plotCI(
x = xvals.f[sorted],
y = yvals.f[sorted],
xlim = c(xmin, xmax), ylim = c(ymin, ymax),
pch =
You could look at the plotCI function in the plotrix package, which
has a separate parameter for setting the linetype of the error bars.
(An additional benefit is that it works with R 2.4.0 -- gplots seems
not to have been updated, or at least the windows binary hasn't, and
still includes a now
On 10/15/2006 11:24 PM, lan gao wrote:
Hi,
I need to call a c funtion in R.I created the Dll in Visual C++.
And In R , I used the dyn(path) no erro.
Then when I call .c (function m=name , parameter) it always says
the c entry point product not in load table
Check that
Thanks, I tried using plotCI in the plotrix library.
This, however, gives me the below error.
CODE::
cat(x = ); print(xvals.f[sorted])
cat(y = ); print(yvals.f[sorted])
cat(pch = ); print(plot_symbols[graph_idx])
cat(lty = ); print(plot_linetypes[graph_idx])
cat(col
Looking at the source code for plotCI, I see that it calls plot with
type specified as n when the error bars are not being added to an
existing plot, so you cannot use the type argument in a call to
plotCI. If you want to add lines as well as points, I think you will
have to use
Great, why didn't I think of that.
Thanks :)
If you want to add lines as well as points, I think you will
have to use lines(x,y,type=b,lty = plot_linetypes[graph_idx]) in
addition to plotCI,
__
R-help@stat.math.ethz.ch mailing list
Hi folks
I have some data to which I've been fitting linear mixed effects
models. I am currently using a lme model in the nlme package, with terms
for random effects due to repeated measures on individuals and the
corCAR1 serial correlation structure. However, there is some suggestion
in the data
Hi,
I am troubled by the use of NULL or NA to indicate
missing/non-specified function arguments.
In the R code that I have looked at, it seems that both forms are used
(NULL seems to be used more often though). Sometimes both variants are
in the same declaration, e.g.
format.default -
bistochastic.3x3 - function() {
B - matrix(0, 3, 3)
## 2 df
tmp.1 - runif(3)
B[1,] - tmp.1/sum(tmp.1)
## 1 df
tmp.2 - runif(2)
B[2:3, 1] - (1-B[1,1]) * tmp.2/sum(tmp.2)
## 1 df
B[2, 2] - runif(1, max=min(1-B[1,2], 1-B[2,1]))
## Fill in the rest
B[2,3] - 1-sum(B[2,
There is also a third way, namely use the missing function
in the code:
f - function(x) if (missing(x)) print(missing) else print(x)
f()
On 10/16/06, Hans-Peter [EMAIL PROTECTED] wrote:
Hi,
I am troubled by the use of NULL or NA to indicate
missing/non-specified function arguments.
In the
Dear R-users,
is there a way to pass a list of patterns to the grep function? I
vaguely remember something with %in% operator...
Thanks,
Stéphane.
--
La science a certes quelques magnifiques réussites à son actif mais
à tout prendre, je préfère de loin être heureux plutôt qu'avoir raison.
Try this:
grep(b|c|d, letters, value = TRUE)
[1] b c d
On 10/16/06, Stéphane CRUVEILLER [EMAIL PROTECTED] wrote:
Dear R-users,
is there a way to pass a list of patterns to the grep function? I
vaguely remember something with %in% operator...
Thanks,
Stéphane.
--
La science a
On 10/16/2006 8:47 AM, Hans-Peter wrote:
Hi,
I am troubled by the use of NULL or NA to indicate
missing/non-specified function arguments.
In the R code that I have looked at, it seems that both forms are used
(NULL seems to be used more often though). Sometimes both variants are
in the
Thx for the hint, but what would I have used if b,c and d
were values of a dataframe for instance?
Stéphane.
Gabor Grothendieck a écrit :
Try this:
grep(b|c|d, letters, value = TRUE)
[1] b c d
On 10/16/06, Stéphane CRUVEILLER [EMAIL PROTECTED] wrote:
Dear R-users,
is there a way to pass
Hi,
I am new to R and I have been trying it out. I ran into a problem with the
plot() function. Below is my code:
d - read.table(c:/test/sp.txt,header=0)
spval - d[,2]
plot(spval,type=l)
Warning messages:
1: graphical parameter type is obsolete in: plot.window(xlim, ylim, log,
asp, ...)
2:
On 16 October 2006 at 11:28, Friedrich Leisch wrote:
| On Sat, 14 Oct 2006 16:04:50 -0700,
| Deepayan Sarkar (DS) wrote:
|
|
|
|%.tex: %.Rnw
|echo library(tools); Sweave('$') | ${R_PROG} --vanilla --silent
|
| Note that we now have R CMD Sweave (new in R 2.4.0) for this
Ooops sorry for html tags... Just forgot to edit the message
before sending it...
So back to my question:
Thx for the hint, but what would I have used if b,c and d
were values of a dataframe for instance?
X is for instance a dataframe:
X
Mypatterns
1 pattern1
2 pattern2
3 pattern3
Y
DF - data.frame(pat = letters[1:3])
grep(paste(DF$pat, collapse = |), letters, value = TRUE)
[1] a b c
On 10/16/06, Stéphane CRUVEILLER [EMAIL PROTECTED] wrote:
Ooops sorry for html tags... Just forgot to edit the message
before sending it...
So back to my question:
Thx for the hint, but
Thanks, I tried someting like this, but computation takes times for large
matrices
btransf-function(y,X=length(y)^4){
N-length(y)
bm-matrix(rep(1/N,N^2),N,N)
for(j in 1:X){
coord-sample(1:N,4,replace=T)
It's possible the problem is with your data; could you provide some
sample data with which we can reproduce the error?
On 16/10/06, tom soyer [EMAIL PROTECTED] wrote:
Hi,
I am new to R and I have been trying it out. I ran into a problem with the
plot() function. Below is my code:
d -
On 10/16/2006 9:44 AM, tom soyer wrote:
Hi,
I am new to R and I have been trying it out. I ran into a problem with the
plot() function. Below is my code:
d - read.table(c:/test/sp.txt,header=0)
spval - d[,2]
plot(spval,type=l)
Warning messages:
1: graphical parameter type is obsolete
Ali - saveez at hotmail.com writes:
R introduces itself as a 'statistical' language and environment. There are
many discussions about comparing R to MATLAB or mathematica (or other
similar software). It seems to me that these other software have a broader
range of applications. For
I am sorry, I can't figure out what your function is doing.
Why do you have N^4 in the argument? A matrix should have
N rows and N columns, that is, it should have length N^2.
The function returns a vector, not a matrix.
There is no example of its use.
I am guessing that your function
Here is a more general way that looks for the transitions:
series1-cbind(Start=c(10,21,40,300),End=c(20,26,70,350))
series2-cbind(Start=c(25,60,210,500),End=c(40,100,400,1000))
x - rbind(series1, series2)
# create +1 for start and -1 for end
x.s - rbind(cbind(x[,1], 1), cbind(x[,2], -1))
For image analysis and general image processing in R, please check
EBImage from bioconductor (www.bioconductor.org). Best, Oleg
Ben Bolker wrote:
Ali - saveez at hotmail.com writes:
R introduces itself as a 'statistical' language and environment. There are
many discussions about comparing
Hi everybody,
I'm trying to analyse a set of data with a non-normal response, 2 fixed
effects and 1 nested random effect with strong heteroscedasticity in the
model.
I planned to use the function lmer : lmer(resp~var1*var2 + (1|rand)) and
then use permutations based on the t-statistic given
you can try something like the following:
B - 10
N - 5
mats - r2dtable(B, rep(1, N), rep(1, N))
out - matrix(0, N, N)
for(i in 1:length(mats))
out - out + mats[[i]]
out - out / B
out
colSums(out)
rowSums(out)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
A simpler approach --- as in similar problems ---
is to use an iterative solution which works quite fast for any 'n'.
Interestingly, the number of necessary iterations seems to
*decrease* for increasing 'n' :
bistochMat - function(n, tol = 1e-7, maxit = 1000)
{
## Purpose: Random
So, Alberto, you didn't see my post? If Y has d independent components that
are gamma distributed with common rate and shapes A_1, A_2, ..., A_d, then X,
given by the components of Y divided by their sum has distribution
Dirichlet(A_1, A_2, ..., A_d). If you want Uniform on the d-simplex,
Yes, you're right. In fact, it's just an adaptation of a matlab command and the
author advises using N^4 replications that's why it's the default in the
function. The bistochastic matrix is not my subject of interest, but I need it
to perform some random tranformation of a vector of incomes.
Thanks, I think it's a shrewd solution, but the problem is that it cannot
generate every N*N bistochastic matrix and every cell tends to 1/N as B tends
to infinity
Florent Bresson
- Message d'origine
De : Dimitris Rizopoulos [EMAIL PROTECTED]
À : Florent Bresson [EMAIL PROTECTED]
Cc :
Thanks, it's perfect for my needs.
- Message d'origine
De : Martin Maechler [EMAIL PROTECTED]
À : Florent Bresson [EMAIL PROTECTED]
Cc : Richard M. Heiberger [EMAIL PROTECTED]; r-help@stat.math.ethz.ch
Envoyé le : Lundi, 16 Octobre 2006, 16h29mn 47s
Objet : Re: [R] Re : Generate a
Grant Izmirlian wrote:
So, Alberto, you didn't see my post?
I think I didn't - but you are demanding too much from my memory;
I can hardly remember what I saw yesterday!
If Y has d independent
components that are gamma distributed with common rate and shapes
A_1, A_2, ..., A_d, then X,
I just installed RMySQL 0.5-9 with R 2.4.0 on Windows XP and got the
following error message when trying to run a script with RMySQL:
Error in library(RMySQL) : 'RMySQL' is not a valid package -- installed
2.0.0?
Any ideas?
Thanks,
Frank
__
Hi David and Duncan,
Thanks for the reply. I am using R-2.4.0 for windows. All I am trying to do
is follow an online tutorial (
http://www.onlamp.com/pub/a/onlamp/2005/11/17/r_for_statistics.html) step by
step. spval is just an array of numbers. I also tried using type=1 instead
of l, but got
I don't think this idea has been suggested yet:
(1) Form all n! n x n permutation matrices,
say M_1, ..., M_K, K = n!.
(2) Generate K independent uniform variates
x_1, ..., x_k.
(3) Renormalize these to sum to 1,
x - x/sum(x)
(4)
RSiteSearch(interval pls) produced 7 hits for me just now. I
didn't study all of them carefully, but I doubt if any one of them have
exactly what you want. One could also search for pls with ordered
factors, but I didn't try that.
However, I doubt if it would be excessively
Yes, I would like every generated matrix to be drawn from a uniform
distribution. Martin Maechler's solution was interesting but when I compute the
product of the obtained matrix with any N-vector Y, the resulting vector is
most of the time quite close to a vector like mean(Y)*rep(1,N).
Tom,
If your text file, 'sp.txt' contains the headers used on that web page,
then your read.table() function call is incorrect.
Your call below presently has 'header = 0'. Use TRUE/FALSE for easier
reading of code. The tutorial seems to be inconsistent with that.
If your text file contains the
On 10/16/2006 11:50 AM, Rolf Turner wrote:
I don't think this idea has been suggested yet:
(1) Form all n! n x n permutation matrices,
say M_1, ..., M_K, K = n!.
(2) Generate K independent uniform variates
x_1, ..., x_k.
(3) Renormalize these to sum to 1,
Friedrich Leisch wrote:
On Sat, 14 Oct 2006 23:00:27 +0100,
Mark Wardle (MW) wrote:
Hello all,
...
Yes, simply set prefix.string to a path, not only a filename. E.g.,
...
Many thanks for everyone's help on this (both on and off list). Working
perfectly now!
Now I just need help
I'm trying to do a linear discriminant analysis on a dataset of three
classes (Affinities), using the MASS library:
data.frame2 - na.omit(data.frame1)
data.ld = lda(AFFINITY ~ ., data.frame2, prior = c(1,1,1)/3)
Error in var(x - group.means[g, ]) : missing observations in cov/cor
What does
Greetings Forum,
I am new to R and and writing in hopes of getting some help.
Our MLE results from a home grown software do not match with that of R. We
are using a censored sample and will really appreciate if you could give us any
pointers as to which MLE method is used in R... to my
If speed is an issue as in large scale (e.g. genomic) problems, then
findInterval is very helpful. See
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/60815.html
for an example.
On Sun, 15 Oct 2006, jim holtman wrote:
Not the most efficient and requires integer values (maybe less
2006/10/16, Duncan Murdoch [EMAIL PROTECTED]:
As Gabor said, the third way is to give no default, but test missing()
in the code.
I forgot this one, thank you. In my case it is probably not suited as
I just pass the arguments to a C (Pascal) function and do the checking
there.
[explanations
On 10/16/06, Hans-Peter [EMAIL PROTECTED] wrote:
2006/10/16, Duncan Murdoch [EMAIL PROTECTED]:
As Gabor said, the third way is to give no default, but test missing()
in the code.
I forgot this one, thank you. In my case it is probably not suited as
I just pass the arguments to a C (Pascal)
Hello,
I want to create a figure that consists of a collection of 16 graphs on
4 rows. I am using
nf - layout(matrix(seq(1,16), 4,4, byrow=TRUE), respect=TRUE)
boxplot(...
to create the layout of my 16 graphs. It works really well. However, I'd
like to add sub-titles that would apply to each
Forgive my ignorance, but shouldn't '\\' be converted into '\' in my
string? In my output (below), you can see that '\\' remains '\\'.
term = mother\'s day
term
[1] mother's day
term = mother\\\'s day
term
[1] mother\\'s day --- should be mother\'s day
Thanks,
Frank
Hello everyone:
I am using the following code to draw my barplot but it has two problems.
BL-c(1.97,8.04,2.54,10.53,4.85,1.73)
LR-c(0.85,0.86,8.33,04.18,6.26,2.40)
Q-c(0.00,0.00,1.92,01.92,4.48,0.00)
cols - ifelse(Q!=0, orange, green)
Graph- barplot(LR, main='LR Value',col=cols, border='black',
Hi Stephane,
Stéphane CRUVEILLER scruveil at genoscope.cns.fr writes:
is there a way to pass a list of patterns to the grep function? I
vaguely remember something with %in% operator...
I think you are looking for the %in% and %nin% which are part of Design package,
and also in Hmisc library.
On 10/16/06, Frank McCown [EMAIL PROTECTED] wrote:
Forgive my ignorance, but shouldn't '\\' be converted into '\' in my
string? In my output (below), you can see that '\\' remains '\\'.
term = mother\'s day
term
[1] mother's day
term = mother\\\'s day
term
[1] mother\\'s day
Thanks Marc. I followed your suggestion and I got R to plot the correct
graph! You are absolutely correct about R switching automatically from
plot() to plot.factor(). I had no idea that it would do that. It looks like
having the header is very important in R. Appreciate your help very much.
On
Gabor Grothendieck [EMAIL PROTECTED] writes:
On 10/16/06, Frank McCown [EMAIL PROTECTED] wrote:
Forgive my ignorance, but shouldn't '\\' be converted into '\' in my
string? In my output (below), you can see that '\\' remains '\\'.
term = mother\'s day
term
[1] mother's day
I found another method to generate this, in the Borg of all Wisdom:
http://en.wikipedia.org/wiki/Simplex
Alberto Monteiro
---
Section Random Sampling:
The second method [[the first method is based on the Dirichlet
distribution -- avfm]] to generate a random point on the unit
simplex is based
And check out the new FAQ 7.37
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-does-backslash-behave-strangely-inside-strings_003f
Thanks, guys, for the help.
Frank
__
R-help@stat.math.ethz.ch mailing list
At 16:12 15/10/2006, Ronaldo ReisJunior wrote:
Em Sábado 14 Outubro 2006 11:15, Gabor Grothendieck escreveu:
Try using OLS starting values:
glm(Y~X,family=gaussian(link=log), start = coef(lm(Y~X)))
Ok, using a starting value the model work.
But, sometimes ago it work without any starting
Hi,
I want to calculate, for any likelihood function, the value(s) of the
parameter of interest that makes the likelihood equal to 1/8-th of the
value of the likelihood at the maximum. Say, with the following toy
example with a binomial distribution and with interest in p:
Hi
Marie-Pierre Sylvestre wrote:
Hello,
I want to create a figure that consists of a collection of 16 graphs on
4 rows. I am using
nf - layout(matrix(seq(1,16), 4,4, byrow=TRUE), respect=TRUE)
boxplot(...
to create the layout of my 16 graphs. It works really well. However, I'd
nand kumar nksathyar at yahoo.com writes:
Greetings Forum,
I am new to R and and writing in hopes of getting some help.
Our MLE results from a home grown software do not match with that of R. We
are using a censored sample and will
really appreciate if you could give us any pointers
Hello,
First,
I would like to congratulations for very cool package! It's very
nice
idea!...
Secondly,
Is there a way to send R'objects (variables) to yacas and make
symbolic
operations??
for example:
d - diag(3)
a - A
yacas( d * a )
Thanks,
Cleber Borges
Gabor Grothendieck wrote:
Specify margins using par(mar=c(5,1,4,2)) before the call to barplot.
You won't be able to see the vertical axis labels with those settings,
though.
On 16/10/06, Mohsen Jafarikia [EMAIL PROTECTED] wrote:
Hello everyone:
I am using the following code to draw my barplot but it has two problems.
On 10/16/2006 5:06 PM, Brahm, David wrote:
Hans-Peter [EMAIL PROTECTED] wrote:
I am troubled by the use of NULL or NA to indicate
missing/non-specified function arguments.
I suggest using NULL for arguments which are vectors or lists of
unspecified length, and NA for scalars (arguments
Its pretty limited right now but you can do this:
library(Ryacas)
d - List(List(1, 0, 0), List(0, 1, 0), List(0, 0, 1))
a - Sym(a)
a * d
expression(list(list(a, 0, 0), list(0, a, 0), list(0, 0, a)))
PrettyForm(%)
/\
| ( a ) ( 0 ) ( 0 ) |
||
| ( 0 ) (
Martin,
I don't think that a doubly stochastic matrix can be obtained from an
arbitrary positive rectangular matrix. There is a theorem by Sinkhorn (Am
Math Month 1967) on the diagonal equivalence of matrices with prescribed row
and column sums. It shows that given a positive matrix A(m x n),
Dear Doug Frank:
Thanks for the reply, Doug. First a comment, then another
question for you, Doug, if you have time:
1. COMMENT: Here's an ugly hack that would seem to answer
Frank's question using 'lmer':
(vt - with(dtf, tapply(x, trth, sd)))
(vr - vt[2]/vt[1])
mod1b -
Hello everyone,
In the following program, I have specified if 'Q!=0', bar color is 'orange'
and if is '0.0', color is green. Now I want to have different colors for
'Q'. For example:
If 'Q=0.0' then color is green
If 'Q=1.92' then color is blue
If 'Q=4.48' then color is red
I also want an
Here is a slightly shorter way to do it although it involves passing
a yacas string directly:
yacas(a * Identity(3))
expression(list(list(a, 0, 0), list(0, a, 0), list(0, 0, a)))
PrettyForm(%)
/\
| ( a ) ( 0 ) ( 0 ) |
||
| ( 0 ) ( a ) ( 0 ) |
|
Hello Gabor
I try these example, but I obtain some errors.
*First example*
yacas(a * Identity(3))
expression(list(list(a, 0, 0), list(0, a, 0), list(0,
0, a)))
it's ok , but the next command:
PrettyForm(%)
Error in PrettyForm(%) : no applicable method for
PrettyForm
If I make a little
Hello
I have been playing with tcl/tk in R 2.4.0 on windows XP and have
managed to crash R by supplying tcl/tk with an incorrect color.
Is this a bug? is there a way for me to test the color to see if it is a
valid tcl/tk color, to avoid this?
tt=tktoplevel()
tklabel(parent=tt, text=hello
On 10/16/06, Cleber N.Borges [EMAIL PROTECTED] wrote:
Hello Gabor
I try these example, but I obtain some errors.
*First example*
yacas(a * Identity(3))
expression(list(list(a, 0, 0), list(0, a, 0), list(0,
0, a)))
it's ok , but the next command:
PrettyForm(%)
Error in
Hi,
I am wondering if a linear model
lm(y~ x1+x2) calculates the variance of a fitted
value.
Thank you
Li
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
The compositional data xi=(x_i1,x_i2,...,x_in), for each fixed i , xij0,
and sum(xij)=1;
I want to compare the mean( u_i) of several groups
i.e.
H0: u_1=u_2=...=u_N
or
H0: u_11=u_21=...=u_N1
Are there any ANOVA tpye tools to do this work in R?
Thanks,
WEN S Q
[[alternative HTML
Hi Gabor,
I'm running Quantian (Debian) inside a VMware virtual machine, on a
Windows XP host.
I installed the latest version of yacas from the source tarball. I
remembered to ./configure --enable-server to allow server connections.
make and make install worked ok, after some fiddling. I
83 matches
Mail list logo