Hi,
Could you please let me know to use a list in a for loop here geneset is a
loop.I am trying to match the names of the list with 1st row of the output.
result<- list()
for(i in 1:length(output)
{
result[[i]] <- geneset(which(geneset %n% output[,1]))
}
Kindly help me out
--
View t
Hi
I have a specific sample coming from a gamma(alpha,theta1) distribution and
then divided into two parts first part follows a gamma(alpha,theta1) the second
is gamma(alpha,theta2) then I would like to find the mle`s for theta1 and
theta2 which I found. Now I would like to simulate those estima
HiI have a specific sample coming from a gamma(alpha,theta1) distribution and
then divided into two parts first part follows a gamma(alpha,theta1) the second
is gamma(alpha,theta2) then I would like to find the mle`s for theta1 and
theta2 which I found. Now I would like to simulate those estimat
Hello,
I'm trying to create a for loop for a data set, I have a list of results in
this data set and I want to take the 1st two add them together and divide by
the mean of the 1st to, then do the same for the 3rd and 4th values in the list
and so on and each time return a value for the calcul
Hi,
I need your help.
I have a vector of numbers reflecting the switch in the perception of a
figure. For a certain period I have positive numbers (which reflect the
perception A) then the perception changes and I have negative numbers
(perception B), and so on for 4 iterations. I need to take
I am trying to get the function "Models" to work each time there is an
instance of k. This code will stop after the first model is complete. I need
it to come back and pass the next value of c into the "Initial.State"
function. any ideas?
col<-c(23:28)
#Setup
for(k in col){
Initial.State(Respon
Hi,
I guess this what your need. I assume your output is 10 by 11 matrix.
However, you still need to define your geneset function(?)
result<- list()
output<-matrix(NA, nrow=10, ncol=11)
for(i in 1:length(ncol(output)))
{
result[[i]] <- geneset(which(geneset %n% output[1,]))
}
Chunha
Hello,
Newbie question and hope you can help .
I have two vector V1 and V2, where length(V2) = length of (V1) * 2;
length(V1) ~ 16,000.
For each member in V1, I need to compare 2 element of V2 for equality
i.e.
for (I in 1:length (V1)) {
if ( v2[i] == v1[i] & v2[i+1]==v1[i] ){
Hi,
I have written the following code which works fine
step<-5
numSim<-15
N<-double(numSim)
A<-double(numSim)
F<-double(numSim)
M<-double(numSim)
genx<-double(numSim)
for (i in 1:numSim) {
N[i]<-20
PN<-(runif(N[i], 0, 1))
A[i]<-sum(ifelse(PN>0.2, 1, 0))
PF<- runif((A[i]*0.5
Hi,
I am trying to find a solution in R for the following C++ code that allows
one to skip ahead in the loop:
for (x = 0; x <= 13; x++){
x=12;
cout << "Hello World";
}
Note that "Hello World" was printed only twice using this C++ loop. I
tried to do the same in R:
for(i in 1:13){
i=12
print
How do I define the incremental step in a "for" loop?
for (j in 1:10){
cat(j, "\n")
}
In the above example, if I want to increment j by 2 where do I specify that?
Thanks
[[alternative HTML version deleted]]
__
R-help@r-project.org mail
Hi all,
apologies if this is obvious - but I can't see it and would appreciate some
quick help!
the matrix mhouse is 26x3 and I'm computing odds ratios. The simple code
below "should" compute the odds vector for every pair (325) i.e. 26C2 in
cols 1 and 2.
On the first i=1 outer loop the inner j
Al,
Is there any "ID" index for the pairs? For example, if the first pair can be
labeled "a", and second pair labeled "b" etc., then you can add an index
column or you may already have such a column in your list. Then run
aggregate(your.data.column, by=index.column, FUN=mean). Or you can just add
Al,
Say, your data file is 'test', execute the following in sequence,
aggregate(test[1],test[2],mean)->inter
names(inter)[2]='mean'
merge(test,inter,all=T)->inter2
inter2$RSV=inter2$Result/inter2$mean
The column 'RSV' in inter2 should be what you want.
Jun
On Tue, Mar 31, 2009 at 11:11 AM, Al
If you add 2 numbers a and b and divide this sum
by the mean of these 2 number, you will always get 2
(a+b)/((a+b)/2) always simplifies to 2.
Alan O'Loughlin wrote:
> Hello,
>
> I'm trying to create a for loop for a data set, I have a list of results in
> this data set and I want to take the
Hi there,
Just wondering if someone can help me with the correct syntax to use
with for loops?
I have split my original file by count, & wish to first of all assign
new tables based on the splits. Then I just want to create a new
variable. Please see code below.
This code works outsid
Hi, I am still not familiar with vectorization.
Could you help with making this for loop more efficient?
The code is trying to make a Q matrix for a multidimensional state space
with specific conditions.
thanks
Mira
tmp = 0:(maxvals[1])
for(i in 2:nchars) {
tmp <- outer(tmp, 0:(maxvals[i]), FU
aledanda wrote:
Hi,
I need your help.
I have a vector of numbers reflecting the switch in the perception of a
figure. For a certain period I have positive numbers (which reflect the
perception A) then the perception changes and I have negative numbers
(perception B), and so on for 4 iterati
What do you mean by "stop"? Is there an error message? What are you
getting as output? I don't see you saving or printing the output from
"Models" (whatever that is). PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, repr
von waltzmiester
Gesendet: Wednesday, August 05, 2009 11:38 AM
An: r-help@r-project.org
Betreff: [R] for loop
I am trying to get the function "Models" to work each time there is an
instance of k. This code will stop after the first model is complete. I need
it to come back and pass the
Jim
Settle down, just because you can't understand my post doesn't mean I didn't
follow the guidlines.
1)The code is commented.
2)The problem in the code is succinct and therefore "minimal" even though it
cannot be self contained, the user-defined function itself is.
3) In order for you to be ab
The Initial.State function is the setup for Models. So Models will apply the
function to k columns in Initial.State. It will only work for the first
element in vector col however, and will not loop the function through all
elements in vector col
-C
waltzmiester wrote:
>
> I am trying to get
-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im
Auftrag von waltzmiester
Gesendet: Wednesday, August 05, 2009 1:22 PM
An: r-help@r-project.org
Betreff: Re: [R] for loop
Jim
Settle down, just because you can't understand my post doesn't mean I didn't
foll
lto:r-help-boun...@r-project.org] Im
Auftrag von waltzmiester
Gesendet: Wednesday, August 05, 2009 1:35 PM
An: r-help@r-project.org
Betreff: Re: [R] for loop
The Initial.State function is the setup for Models. So Models will apply the
function to k columns in Initial.State. It will only work for th
On Aug 5, 2009, at 1:22 PM, waltzmiester wrote:
Jim
Settle down, just because you can't understand my post doesn't mean
I didn't
follow the guidlines.
1)The code is commented.
2)The problem in the code is succinct and therefore "minimal" even
though it
cannot be self contained, the user
Um I still followed the guidelines...
David Winsemius wrote:
>
>
> On Aug 5, 2009, at 1:22 PM, waltzmiester wrote:
>
>>
>> Jim
>>
>> Settle down, just because you can't understand my post doesn't mean
>> I didn't
>> follow the guidlines.
>> 1)The code is commented.
>> 2)The problem in the
You followed only the ones you thought were important, but failed...
a) to reduce the problem to a reproducible form (and gave no evidence
of even trying to do so.) and failed ...
b) to read the helpful reply you got from Jim, which I suspect
contained the answer, and now ...
c) persist in th
Hi,
On Aug 5, 2009, at 2:36 PM, waltzmiester wrote:
Um I still followed the guidelines...
Focus on trying to ask a better question rather than going down this
route ...
Honestly, your original question is rather vague and leaves us to
guess (i) what you're trying to do, and (ii) how to
liche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im
Auftrag von waltzmiester
Gesendet: Wednesday, August 05, 2009 2:37 PM
An: r-help@r-project.org
Betreff: Re: [R] for loop
Um I still followed the guidelines...
David Winsemius wrote:
>
>
>
Dear Rusers,
I am still an unexperienced builder of functions and loops, so my question is
very basic: Is it possible to introduce a second variable (j) into my loop.
To examplify:
# This works fine:
fn <- function (x) {if (x>46 & x<52) 1 else 0}
res <-NULL
for (i in 40:60) res <-c(res,fn(i))
My Coyne wrote:
> Hello,
>
>
>
> Newbie question and hope you can help .
>
> I have two vector V1 and V2, where length(V2) = length of (V1) * 2;
> length(V1) ~ 16,000.
>
> For each member in V1, I need to compare 2 element of V2 for equality
If just the comparison is concerned, you can do
WRT: Say length(V1) is n, do you want to compare
> v1[1] with v2[1] and v2[2] and v1[2] with v2[3] and v2[4]
> or
> v1[1] with v2[1] and v2[n+1] and v1[2] with v2[2] and v2[n+2]
v1[1] with (v2[1] and v2[2])
v1[2] with (v2[3] and v2[4])
v1[3] with (v2[5] and v2[6])
...
v1[n] with (v2[n+1] an
[EMAIL PROTECTED] wrote:
> WRT: Say length(V1) is n, do you want to compare
>> v1[1] with v2[1] and v2[2] and v1[2] with v2[3] and v2[4]
>> or
>> v1[1] with v2[1] and v2[n+1] and v1[2] with v2[2] and v2[n+2]
>
> v1[1] with (v2[1] and v2[2])
> v1[2] with (v2[3] and v2[4])
> v1[3] with (v2[5] and
Hi Uwe,
Thank you so much for your help. It works great with your
suggestion/help. WOW, what a difference!
--MyC
>
>
> [EMAIL PROTECTED] wrote:
>> WRT: Say length(V1) is n, do you want to compare
>>> v1[1] with v2[1] and v2[2] and v1[2] with v2[3] and v2[4]
>>> or
>>> v1[1] with v2[1] and v2[n
Is this what you want?
> numSim <- 15
>
> genx<-double(numSim)
> N <- rep(20, numSim)
> A <- F <- M <- numeric(numSim)
>
> result <- lapply(1:5, function(.x){
+ for (i in 1:numSim) {
+ PN<-(runif(N[i], 0, 1))
+ A[i]<-sum(ifelse(PN>0.2, 1, 0))
+ PF<- runif((A[i]*0.5), 0,
11 April 2008 12:26 PM
To: r-help@r-project.org
Subject: [R] for loop help
Hi,
I am trying to find a solution in R for the following C++ code that
allows
one to skip ahead in the loop:
for (x = 0; x <= 13; x++){
x=12;
cout << "Hello World";
}
Note that "Hello World" was pri
On 11.04.2008, at 05:38, <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> wrote:
>> ?`break`
>> ?`next`
>>
>
>
>> for(i in 1:13) {
>>
> if(i < 13) next
> print("Hello!\n")
> }
> [1] "Hello!\n"
>
>>
>>
>
> I am trying to find a solution in R for the following C++ code that
> allows
> one to s
Tom,
Bill Venables gave you references to important tools for dealing with
for loops in R and they may be all the solution that you need. But here
is a little more detail on what is going on in case you want/need more
control in the future.
Note that the R for loop is what some programers call
Hello,
I am trying to assign a variable name (x1,x2,x3...) in a loop statement
that is based on a counter (counter is based on the number of hours
within the datafile). The x1,x2 data will later be called for plotting
the data. Below is a clip of the for loop I am using, any suggestions?
k
You are doing it in your bit about 1:10, which is shorthand for
generating a sequence 1, 2, 3, ..., 9, 10. Use ?seq to do what you
want.
for(i in seq(1, 10, by = 2))
cat(i, "\n")
Best,
Erik
Nair, Murlidharan T wrote:
How do I define the incremental step in a "for" loop?
for (j in 1:10){
Hi,
> Why isn't my loop incrementing i - the outer loop to 2 and then resetting
> j=3?
It is. It runs out of bounds with j > 26
> Am I missing something obvious?
> > for (i in 1:25)
> + {
> + for (j in i+1:26)
You miss parentheses.
i + 1 : 26 is i + (1 : 26) as the
Hi
start simple!
Work out *each* row combined with *each* row,
to give (in your case) a 26-by-26 matrix.
Only after you have got this working, start thinking about
making it run faster [eg by
only evaluating the upper triangular entries]
To do a nested loop, do
M <- matrix(0,n,n)
for(i in
What do you expect this statement to do:
trial[i] <- data.frame(A2$`i`)
what is `i` supposed to mean? What is it that you want to do?
On Mon, Apr 27, 2009 at 10:25 AM, Bronagh Grimes
wrote:
> Hi there,
>
>
>
> Just wondering if someone can help me with the correct syntax to use
> with fo
uhoh, missed two lines on the top.Sorry about that.
the whole code looks like this.
nchars = 4
maxvals = c(2,2,2,2)
tmp = 0:(maxvals[1])
for(i in 2:nchars) {
tmp <- outer(tmp, 0:(maxvals[i]), FUN="paste", sep=".")
}
states = tmp
stateidx = array(1:length(states), dim=dim(states))
transition <-
this 'ifelse' usage looks promising.
thank you very much.
On Thu, May 7, 2009 at 3:12 PM, Patrick Burns wrote:
> If you haven't seen it yet,
> 'The R Inferno' may be of use
> to you.
>
>
> Patrick Burns
> patr...@burns-stat.com
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of "The R I
On 7/29/2008 7:55 AM, Oehler, Friderike (AGPP) wrote:
Dear Rusers,
I am still an unexperienced builder of functions and loops, so my question is
very basic: Is it possible to introduce a second variable (j) into my loop.
To examplify:
# This works fine:
fn <- function (x) {if (x>46 & x<52) 1 els
ilto:[EMAIL PROTECTED]
Namens Oehler, Friderike (AGPP)
Verzonden: dinsdag 29 juli 2008 13:56
Aan: Oehler, Friderike (AGPP); r-help@r-project.org
Onderwerp: [R] 'for' loop, two variables
Dear Rusers,
I am still an unexperienced builder of functions and loops, so my
question is
very basic: I
On 29.Jul.2008, at 14:13, ONKELINX, Thierry wrote:
Dear Frederike,
#Both your functions are vectorized. So you don't need loops. Working
with vectorized functions is much faster than looping.
fn <- function (x,y) {
ifelse(x>46 & x<52 & y<12, 1, 0)
}
datagrid <- expand.grid(i = 40:60, j = 0
Hi,
I'm heaving difficulties with a dataset containing gene names and positions
of those genes.
Not such a big problem, but each gene has multiple exons so it's hard to say
where de gene starts and where it ends. I want the starting and ending
position of each gene in my dataset.
Attached is the
Hello,
I am trying to apply a least squares non-linear regression to my
dataset, dem16. I can apply it to a subset based on a single site
fine, but I want to apply it to each (of 197) sites. I am stumbling
over a "for" loop. Site and Mean_Air are variables in my dataset and
I would like to
Douglas -
To answer your question directly, use perhaps combination of ?assign and
?paste.
In general, you usually do not have to do this sort of thing, but can
use one of the apply family of functions (apply, sapply, lapply, mapply)
to do whatever you want with shorter, cleaner code and few
I had to do the same thing many times, i usually use a combination of the
functions "eval", "parse" and "sprinf", as below:
k <- 1
for (i in 1:length(stats$hour)) {
eval(parse(text=sprintf("x%s <- dataset[%s,(3:15)]", i, k)))
k <- k+1
}
what it does is:
eval(parse(text=STRING)) is a way to
Take a look at ?assign
Juan Manuel Barreneche wrote:
I had to do the same thing many times, i usually use a combination of the
functions "eval", "parse" and "sprinf", as below:
k <- 1
for (i in 1:length(stats$hour)) {
eval(parse(text=sprintf("x%s <- dataset[%s,(3:15)]", i, k)))
k <- k+1
Consider using a 'list' instead of creating a lot of objects that you then
have to manage:
x <- lapply(1:length(stats$hour), function(.indx) dataset[.indx, 3:15])
You can then access the data as x[[1]], ...
On Tue, May 20, 2008 at 12:58 PM, Douglas M. Hultstrand <
[EMAIL PROTECTED]> wrote:
> He
date <- as.POSIXlt(Sys.time()) #present date
for (i in 1:difftime(as.POSIXlt(Sys.Date()),"2007-10-01"))
if (date$wday != 0 & date$wday != 6) {print(date);assign("date",
(date-86400))} else (assign("date", (date-86400)))
I am trying to print dates from present day to a day
date <- as.POSIXlt(Sys.time()) #present date
for (i in 1:difftime(as.POSIXlt(Sys.Date()),"2007-10-01"))
if (date$wday != 0 & date$wday != 6) {print(date);assign("date",
(date-86400))} else (assign("date", (date-86400)))
I am trying to print dates from present day to a da
date <- as.POSIXlt(Sys.time()) #present date
for (i in 1:difftime(as.POSIXlt(Sys.Date()),"2007-10-01"))
if (date$wday != 0 & date$wday != 6)
{print(date);assign("date", (date-86400))} else (assign("date", (date-86400)))
I am trying to print dates from present day to a day in the
I am trying to load binary files in the following fashion
load("pred/Pred_pres_a_indpdt")
load("pred/Pred_pres_b_indpdt")
load("pred/Pred_pres_c_indpdt")
load("pred/Pred_pres_d_indpdt")
load("pred/Pred_pres_e_indpdt")
load("pred/Pred_pres_f_indpdt")
but I would like to set up a for loop to repla
Hey guys,
How do I iterate such that I add 100 to the counter every time?
Suppose: for (i in c(1:100))
I want i to be 1, 10, 20, 30, ... instead of 1,2,3,4,5 ...
How can this be done?
Thanks,
Vivek
__
R-help@r-project.org mailing list
https://stat.e
Dear R-Users,
I am working on an Hierarchical Bayes model and tried to replace the inner
for-loop (which loops over a list with n.observations elements) with truely
vectorized code (where I calculated everything based on ONE dataset over all
respondents).
However, when comparing the performance
> I'm heaving difficulties with a dataset containing gene names and
positions
> of those genes.
> Not such a big problem, but each gene has multiple exons so it's hard to
say
> where de gene starts and where it ends. I want the starting and ending
> position of each gene in my dataset.
> Attached
On Tue, Jan 06, 2009 at 07:21:48AM -0800, Sake wrote:
> I'm heaving difficulties with a dataset containing gene names and positions
> of those genes.
> Not such a big problem, but each gene has multiple exons so it's hard to say
> where de gene starts and where it ends. I want the starting and endi
On Tue, 6 Jan 2009, Sake wrote:
Hi,
I'm heaving difficulties with a dataset containing gene names and positions
of those genes.
Not such a big problem, but each gene has multiple exons so it's hard to say
where de gene starts and where it ends. I want the starting and ending
position of each g
Sake wrote:
>
> Hi,
>
> I'm heaving difficulties with a dataset containing gene names and
> positions of those genes.
> Not such a big problem, but each gene has multiple exons so it's hard to
> say where de gene starts and where it ends. I want the starting and ending
> position of each gene i
On Wed, Jan 7, 2009 at 3:51 AM, Sake wrote:
> aggregate(data[, c("Exon_Start.Chr.")], by = list(data$Gene), min)
> aggregate(data[, c("Exon_Stop.Chr.")], by = list(data$Gene), max)
That could be written:
aggregate(data["Excon_Start.Chr."], data["Gene"], min)
aggregate(data["Excon_Start.Chr."], d
I have one final question...
How can I save a CSV ifile with ; separation in stead of , separation?
I know the write.csv(file="filename.csv") an that you can use sep=";" when
you open a .csv file, but that doesn't work with the write.csv command.
--
View this message in context:
http://www.nabbl
Try using:
write.table(..., sep=";")
write.csv just calls write.table
On Mon, Jan 12, 2009 at 6:38 AM, Sake wrote:
>
> I have one final question...
> How can I save a CSV ifile with ; separation in stead of , separation?
> I know the write.csv(file="filename.csv") an that you can use sep=";" wh
write.csv does exactly what you would expect ... creates a *Comma*
Separated Values file. If you don't want a comma separated value
format then use write.table with sep=";"
You can still name it "whatever.csv".
Or you if you also intend commas for decimal points, use write.csv2
as describ
There is write.csv2 on the same help page as write.csv!
'write.csv' uses '"."' for the decimal point and a comma for the
separator.
'write.csv2' uses a comma for the decimal point and a semicolon
for the separator, the Excel convention for CSV files in some
Western Europ
Thanks! Why did I not think at that myself. .csv means 'Comma Separated
Value'
David Winsemius wrote:
>
> write.csv does exactly what you would expect ... creates a *Comma*
> Separated Values file. If you don't want a comma separated value
> format then use write.table with sep=";"
>
> Yo
> results[i]<- nls(Tw ~ mu + ((alpha - mu)/(1 + exp(gamma*(B -
> Mean_Air,
> data = dem16,
> start = list(mu = 0.0001, alpha = 21.8, gamma = 0.22, B = 12.8))
> }
If you have a variable that codes "site" then you can try something
like this to get the parameters over sites.
Dear list,
I'm trying to query a string of numbers to identify where in the string the
numbers stop increasing (where x[i] == x[i+1]). In example 1 below, I've
adapted code from Jim Holt to do this. However, I run into situations where the
condition is not met, as in example 2, where the number
I have a series of csv files in several folders. All begin with a 7 digit
number and end with the letter "E" (eg. 0726016E.csv).
I want to be able to read a file in to R, take some of the data out of it
and store it in a matrix, then move on to the next file and do the same
thing.
I was planning
See ?seq.Date, e.g.
now <- Sys.Date()
dd <- seq(now - 20, now, by = "day")
dd[as.POSIXlt(dd)$wday %% 6 != 0]
and have a look at R News 4/1.
On 10/15/07, Vishal Belsare <[EMAIL PROTECTED]> wrote:
> date <- as.POSIXlt(Sys.time()) #present date
> for (i in 1:difftime(as.PO
Hi i am very new to R and I have been trying to change each individual piece
of data in a data set to 10 if it is below 0 and 5 if it is above 0. I know
this sounds very easy but i am struggling!!
--
View this message in context:
http://www.nabble.com/For-loop-for-distinguishing-negative-numbers
Dear Chris,
Try this:
x <- c("a","b","c","d","e","f")
sapply(x, function(i){
i <- paste("pred/Pred_pres_",i,"_indpdt", sep ="")
load(i)
}
)
HTH,
Jorge
On Thu, Jul 30, 2009 at 4:06 PM, waltzmiester wrote:
>
> I am trying to load binary files in t
Try this,
files = paste('pred/Pred_pres_', letters[1:6], '_indpdt',sep="")
lapply(files, load)
HTH,
baptiste
2009/7/30 waltzmiester :
>
> I am trying to load binary files in the following fashion
>
> load("pred/Pred_pres_a_indpdt")
> load("pred/Pred_pres_b_indpdt")
> load("pred/Pred_pres_c_ind
Try this:
sapply(sprintf("pred/Pred_pres_%s_indpt", x), load, envir = .GlobalEnv)
You need set the envir argument to global environment inside the sapply.
On Thu, Jul 30, 2009 at 5:06 PM, waltzmiester wrote:
>
> I am trying to load binary files in the following fashion
>
> load("pred/Pred_pres_
Thanks very much for these two solutions, but they are still printing
"Pred_pres_[i]_indpdt" on the screen and not executing the function load
Chris
baptiste auguie-5 wrote:
>
> Try this,
>
> files = paste('pred/Pred_pres_', letters[1:6], '_indpdt',sep="")
>
> lapply(files, load)
>
>
> HT
I'm just guessing but what about
letters <- letters[1:6]
mynames <- paste("pred/Pred_pres_",letters,"_indpdt")
for(i in 1:6) load(mynames[i])
--- On Thu, 7/30/09, waltzmiester wrote:
> From: waltzmiester
> Subject: Re: [R] for loop for file names
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of waltzmiester
> Sent: Thursday, July 30, 2009 1:29 PM
> To: r-help@r-project.org
> Subject: Re: [R] for loop for file names
>
>
> Thanks very much f
Hi,
On Aug 3, 2009, at 12:09 PM, Vivek Ayer wrote:
Hey guys,
How do I iterate such that I add 100 to the counter every time?
Suppose: for (i in c(1:100))
I want i to be 1, 10, 20, 30, ... instead of 1,2,3,4,5 ...
How can this be done?
?seq
-steve
--
Steve Lianoglou
Graduate Student: Com
Got it..Thanks
Vivek
On Mon, Aug 3, 2009 at 9:13 AM, Steve
Lianoglou wrote:
> Hi,
>
> On Aug 3, 2009, at 12:09 PM, Vivek Ayer wrote:
>
>> Hey guys,
>>
>> How do I iterate such that I add 100 to the counter every time?
>>
>> Suppose: for (i in c(1:100))
>>
>> I want i to be 1, 10, 20, 30, ... inst
On 05-Mar-08 23:37:42, zack holden wrote:
> Dear list,
> I'm trying to query a string of numbers to identify where in the string
> the numbers stop increasing (where x[i] == x[i+1]). In example 1 below,
> I've adapted code from Jim Holt to do this. However, I run into
> situations where the conditi
To get the file names in the current directory try:
list.files(pattern="[[:digit:]]{7}E")
On Tue, Dec 2, 2008 at 4:11 PM, Steven Kennedy <[EMAIL PROTECTED]> wrote:
>
> I have a series of csv files in several folders. All begin with a 7 digit
> number and end with the letter "E" (eg. 0726016E.csv)
Hi,
I have written a for loop as such:
model<-lm(Normalised~Frame,data=All,subset=((Subject==1)&(Filmclip=="Strand")))
summary(model)
###
#To extract just the Adjusted R squared
###
rsq<-summary(model)[[9]]
##
see ?ifelse
you didn't specify what happens if a value is exactly zero in the dataset
and so i've just bundled it in with the negative case:
x <- rnorm(20, 0, 1)
y<-ifelse(x<=0, 10, 5)
HTH,
Tony Breyal
cmga20 wrote:
>
> Hi i am very new to R and I have been trying to change each individual
Hi
r-help-boun...@r-project.org napsal dne 15.07.2009 17:59:39:
>
> see ?ifelse
>
> you didn't specify what happens if a value is exactly zero in the
dataset
> and so i've just bundled it in with the negative case:
>
> x <- rnorm(20, 0, 1)
> y<-ifelse(x<=0, 10, 5)
For this simple case you ca
Hello,
I am fairly new to R programming. I have a series of netcdf files that
I am able to open one at a time using open.ncdf. I want to write this
into an R script so that I can successively open each file by date in a
for-loop. Any suggestions?
Thanks
Brian Pettegrew
--
Brian Pettegre
Hello,
I would like to apply the EF function (a goodness of fit test between
predicted (ts2) and observed (Tw) values in the qualV package) to
each of the Sites in my data frame. However, when I try the following
script, R gives an error message that lists unused arguments, which
include th
Melissa2k9 wrote:
Hi,
I have written a for loop as such:
model<-lm(Normalised~Frame,data=All,subset=((Subject==1)&(Filmclip=="Strand")))
summary(model)
###
#To extract just the Adjusted R squared
###
rsq<-summary(model)
Uwe Ligges-3 wrote:
>
>
>
> Melissa2k9 wrote:
>> Hi,
>>
>> I have written a for loop as such:
>>
>> model<-lm(Normalised~Frame,data=All,subset=((Subject==1)&(Filmclip=="Strand")))
>> summary(model)
>>
>> ###
>> #To extract just the Adjusted R squared
>>
Melissa2k9 wrote:
Uwe Ligges-3 wrote:
Melissa2k9 wrote:
Hi,
I have written a for loop as such:
model<-lm(Normalised~Frame,data=All,subset=((Subject==1)&(Filmclip=="Strand")))
summary(model)
###
#To extract just the Adjusted R squared
Hi, you may use list.files('dir-of-your-files', ...) to get the paths
of all the files, and use file.info() to get the date attribute, then
order them by date, and finally in a loop
for(i in paths-of-your-files){
open.ncdf(i, ...)
...
}
Regards,
Yihui
--
Yihui Xie <[EMAIL PROTECTED]>
Phone: +86-(
Dear R community,
I wrote a small program using for loop but it does not make cycles.
My data: Dataframes: a2, a1, b0 and b1. Vector: d
I would like to get b1 for each of i., i.e. totally 11. However, the program
gives me b1 only for the last i =11.
d<-as.vector(levels(a2$combin2))
for (
I am trying to simplify my code by adding a for loop that will load and
compute a sequence of code 10 time. They way i run it now is that the same
8 lines of code are basically reproduced 10 times. I would like to replace
the numeric value in the code (e.g. Bin1, Bin2Bin10) each time the loo
You got exactly what you were asking for: the value the last time through
the loop. If you are trying to capture all 11 values, then you might
consider a list:
d<-as.vector(levels(a2$combin2))
a1 <- b1 <- vector('list',11)
for (i in 1:11){
a1[[i]] <-a2[a2$combin2%in%d[i],]
b1[[i]]<-b0[b0$Date%in%
# I would put this in a list in the following manner
Bin <- lapply(1:10, function(.file){
#---
#Loads bin data frame from csv files with acres and TAZ data
fileName <-
paste("I:/Research/Samba/urb_transport_modeling/LUSDR/Workspace/BizLandPrice/data/Bin_lookup_values/Bin",
.file,
Hello,
I'm trying to build a for loop, where I estimate a series of models with
different sets of (time series) data.
However my for loop doesn't recognize the "i"
# code
window.1=anomalies.CAK[(positions(anomalies.CAK)>=timeDate("1/1/1971") &
positions(anoma
?for doesn't return anything help.search("for") doesn't return anything-
Is the for loop so prevelant in computer programing that the
documentation is implicit or is R paradigm to discourage the use of
the for loop.
I will post data probably tonight, but here is my problem. I have
preformed an MD
1 - 100 of 105 matches
Mail list logo