Not sure exactly what 'results' is doing there or 'barplot(table(i),...)'
does [see ?table]
but I think this is sort of what you want to do?
## Variable assignment
G01_01 - 1:10
G01_02 - 2:6
## Combine to list*
varnames - paste(G01_,substring(100+1:2,2),sep=)
vars -
On 8/4/07, Donatas G. [EMAIL PROTECTED] wrote:
I have a data.frame with ~100 columns and I need a barplot for each column
produced and saved in some directory.
I am not sure it is possible - so please help me.
this is my loop that does not work...
vars - list (substitute (G01_01),
I have a data.frame with ~100 columns and I need a barplot for each column
produced and saved in some directory.
I am not sure it is possible - so please help me.
this is my loop that does not work...
vars - list (substitute (G01_01), substitute (G01_02), substitute (G01_03),
substitute
it an int. Also, be sure to
read up on the apply family of functions as an alternative to using
loops in R code.
Jeff
--
http://biostat.mc.vanderbilt.edu/JeffreyHorner
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r
Any time you are calling a function one value at a time,
it is worth asking if you can eliminate a loop (or more).
If 'G.fun' is vectorized in its first argument, then you can
easily get rid of the three inner loops. Just generate a
vector of all of the values and do:
gj -
Hi,
is there a way of simplifying the following code:
G - rep(NA,n)
for(i in 1:n)
{
gj - 0
for(j in 1:n)
{
for(l in 1:n)
{
for(m in 1:n)
{
gj - gj+G.fun(XB[i]+p[3]*X[j,3]+p[4]*X[l,4]+p[5]*X[m,5],ff)
}
}
}
G[i] - gj/n^3
}
Thanks.
Joaquim Santos
__
Hello everybody
I'm very new at using R so probably this is a very stupid question.
I have a matrix of p columns and I have to calculate for each of them the
two sample t-statistic and p-value and to save the results into two different
vectors.
I have divided my matrix into two submatrices:
Hi
I'm sorry about the triviality of my problem. I have a vector (v) of three
columns (logA, logB, id). I want to compute (and plot) the correlation between
logA and logB for different thresholds of id (e.g. 30, etc). So I tried:
for(i in 1:100){
points(cor(v$logA[v$idi], v$logB[v$idi],
Hello,
I think you are trying to combine too many things into one.
for(i in 1:100){
points(cor(v$logA[v$idi], v$logB[v$idi], use=complete.obs), i))
}
(i created a plot object already)
For points() you need to have x and y, but you are giving the output of
cor()
This will plot your data
to calculate the distance from each point in the
one frame
to every point in the second...
But how to do this without loops, how to do it quickly? I would
appreciate it very much, if someone would introduce me to the
high art
of R - avoiding loops :-).
Cheers, Dax
From: Frank Samuelson [EMAIL PROTECTED]
Along the lines of this thread,
is there a general apply type function that
allows me to take one vector at a time from a matrix (or
row from a data frame) and another vector from another matrix
and apply them on a general function? Sort of a
- avoiding loops :-).
Cheers, Dax.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
from each point in the
one frame
to every point in the second...
But how to do this without loops, how to do it quickly? I would
appreciate it very much, if someone would introduce me to the
high art
of R - avoiding loops :-).
Cheers, Dax
- avoiding loops :-).
Cheers, Dax.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
To whoever this may concern
I am trying to write a repeat loop and can't make out from the documentation on
the website how exactly to construct the repeat, break structure of the loop.
Below is the function sim2.dat that I am trying to create, in which firstly I
create n random uniform(0,1)
[j]F){break}
}
u[j]-k
}
u
}
- Original Message -
From: Michael Gray [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Sent: Tuesday, December 28, 2004 12:47 PM
Subject: [R] R: repeat loops
To whoever this may concern
I am trying to write a repeat loop and can't make out from
Dear lists,
I want to construct a loop in R, but don't know how to do it. I can do it
in SAS, but I prefer in R (which I am hoping I will off SAS for good
soon). Could anyone help me to convert the SAS codes to equivalent R codes.
Basically, the following codes were written to establish the
Thanks Peter.
Basically, I am trying to establish the line of marker allele the progeny
has inherited from either the sire or the dam. The progeny will share the
sires but each have different dam (ie., daughter design or half-sib model).
The SAS code I have written to identify the lines of
On Mon, 6 Dec 2004 13:36:37 +1300
[EMAIL PROTECTED] wrote:
Dear lists,
I want to construct a loop in R, but don't know how to do it. I can do it
in SAS, but I prefer in R (which I am hoping I will off SAS for good
soon). Could anyone help me to convert the SAS codes to equivalent R codes.
Hi,
I'm a complete beginner to all this so I was hoping someone could help
me!
What I'm trying to do is to write a function that returns the
coordinates where a vector x is equal to a. So say I invent a vector x:
x-c(,5,8,9,8,3).
If a is a-8.
I want the function to return the
Laura Collins wrote:
Hi,
I'm a complete beginner to all this so I was hoping someone could help
me!
What I'm trying to do is to write a function that returns the
coordinates where a vector x is equal to a. So say I invent a vector x:
x-c(,5,8,9,8,3).
If a is a-8.
I want the function to
From: Laura Collins
Hi,
I'm a complete beginner to all this so I was hoping someone could help
me!
What I'm trying to do is to write a function that returns the
coordinates where a vector x is equal to a. So say I invent
a vector x:
x-c(,5,8,9,8,3).
If a is a-8.
I want the
Hi there,
I am running Monte Carlo Simulations in R using ordinary while
(condition) loops. Since the number of iterations is something like
100.000 and within each iteration a given subsample is extended
sequentially it takes hours to run the simulation.
Does anyone know if there is either
On Tue, 28 Sep 2004 13:46:04 +0200, Nael Al Anaswah
[EMAIL PROTECTED] wrote :
Hi there,
I am running Monte Carlo Simulations in R using ordinary while
(condition) loops. Since the number of iterations is something like
100.000 and within each iteration a given subsample is extended
Hi!
Have you taken a look at the MCMCpack - package on cran:
This package contains functions for posterior simulation for a number
of statistical models. All simulation is done in compiled C++ written in
the Scythe Statistical Library Version 1.0. All models return coda mcmc
objects that can
The key is to assign space in advance -- e.g., compare:
N - 2
res - NULL
system.time( for(i in 1:N) res - c(res, sample(10)) )
[1] 28.62 8.91 37.79 0.00 0.00
res - vector(list,N)
system.time( for(i in 1:N) res[[i]] - sample(10) )
[1] 0.45 0.00 0.44 0.00 0.00
res - matrix(0.0, N,10)
Hi,
is it possible doing this moving average
without a loop, because it is not really
fast for dim(x) 300.000 50.
I make some attempts with apply and sapply,but didn't get success until now.
many thanks , christian
ma - function(x, FUN=mean, lag=5)
{
FUN=match.fun(FUN)
Christian Schulz wrote:
Hi,
is it possible doing this moving average
without a loop, because it is not really
fast for dim(x) 300.000 50.
On the other hand, building a matrix before consumes too much memory.
The best way of doing it is using an already existing function (you
might want to
Hi R-helpers!
I'd like to compute the values
x(i)-x(n-i-1) for i=1 n/2 or similar (as way of testing distribution symmetry
hypothesis). It is very easy to do that with a loop but can that be avoided?
Thanks
Anne
[[alternative HTML version deleted]]
On Fri, 25 Jun 2004, Anne Piotet wrote:
I'd like to compute the values
x(i)-x(n-i-1) for i=1 n/2 or similar (as way of testing distribution symmetry
hypothesis). It is very easy to do that with a loop but can that be avoided?
Is that really what you want (not x[n-i+1])? x - rev(x) gives
Hi,
i make some practice on loops to understand this important
issue in difference to the wrappers like apply finally!
The point is that i want plot's for different different const and wish in one
pdf the 5 plots . So i want plots for const=1:5 which change the undelying
data expressed in
Hi
If you make the pdf() call BEFORE entering the loop does it do what you
want?
Paul
Christian Schulz wrote:
Hi,
i make some practice on loops to understand this important
issue in difference to the wrappers like apply finally!
The point is that i want plot's for different different const
yes, yesterday when i go to
sleep i recognize my stupid error!
Thanks,Christian
Am Dienstag, 17. Februar 2004 03:42 schrieb Paul Murrell:
Hi
If you make the pdf() call BEFORE entering the loop does it do what you
want?
Paul
Christian Schulz wrote:
Hi,
i make some practice on loops
Hello R people!
How can one use a for loop (or something similar) in R? As I type in each
line, I get syntax errors... I'm just confused how much to type in at each
prompt.
Thanks for your help,
cathy
~~~
Catherine
On Mon, 2004-02-02 at 13:42, Catherine Stein wrote:
Hello R people!
How can one use a for loop (or something similar) in R? As I type in each
line, I get syntax errors... I'm just confused how much to type in at each
prompt.
Thanks for your help,
cathy
Hello.
I believe you want
Catherine Stein wrote:
How can one use a for loop (or something similar) in R? As I type in each
line, I get syntax errors... I'm just confused how much to type in at each
prompt.
Have you read help(for) (you need to quote 'for' here to avoid a
syntax error!)?
If you'd shown us exactly what
Hi
On 2 Feb 2004 at 8:42, Catherine Stein wrote:
Hello R people!
How can one use a for loop (or something similar) in R? As I type in
each line, I get syntax errors... I'm just confused how much to type
Use curly braces
for (i in ...) {
your long commands
in several lines
}
An
I feel greedy posting for help twice in one day- please forgive me, but the
thesis can't wait.
I have been trying to get an if
else statement working in a loop I am
writing, in which I specify a variable value to 9.2 (Wo) on the first
iteration, but for subsequent iterations, to adopt a
38 matches
Mail list logo