Re: [R] R loop problem

2011-08-04 Thread testrider
Worked like a charm! Thanks a lot Jean V Adams -- View this message in context: http://r.789695.n4.nabble.com/R-loop-problem-tp3718449p3718670.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https

Re: [R] R loop problem

2011-08-04 Thread Jean V Adams
Cell) 715-623-6773 (FAX) http://www.glsc.usgs.gov (GLSC web site) http://profile.usgs.gov/jvadams (My homepage) jvad...@usgs.gov (E-mail) From: testrider To: r-help@r-project.org Date: 08/04/2011 07:21 AM Subject: [R] R loop problem Sent by: r-help-boun...@r-project.org I have run into a spee

Re: [R] R loop problem

2011-08-04 Thread jim holtman
ution but i did not find any usefull websites, probably > because i cannot pinpoint the best search words. > > -- > View this message in context: > http://r.789695.n4.nabble.com/R-loop-problem-tp3718103p3718103.html > Sent from the R help mailing list archive at Nabble.com. &g

[R] R loop problem

2011-08-04 Thread testrider
find any usefull websites, probably because i cannot pinpoint the best search words. -- View this message in context: http://r.789695.n4.nabble.com/R-loop-problem-tp3718103p3718103.html Sent from the R help mailing list archive at Nabble.com. __

[R] loop problem

2011-02-10 Thread Rocio Ponce
Hi there, I'm new working with R and I am trying to find the unchosen set of islands that are closer to all the possible combination (of 2 out of 13) of a set of chosen islands. In other words, if I have a set of 13 islands (1, 2, ...13) and choose all the possible combination of 2 islands (1-2, 1-

Re: [R] loop problem

2009-10-02 Thread David Winsemius
On Oct 2, 2009, at 7:34 AM, crenial30 wrote: Thanks a lot David for your answer. I am sorry for being so minimal. I wanted to produce a list/vector/table consisting each vector produced from this code len<-20 for (n1 in seq(0,(len-1),by=1)){ f <- R_event[R_event > (rx[1]+ n1*300)& R_even

Re: [R] loop problem

2009-10-02 Thread crenial30
Thanks a lot David for your answer. I am sorry for being so minimal. I wanted to produce a list/vector/table consisting each vector produced from this code len<-20 for (n1 in seq(0,(len-1),by=1)){ f <- R_event[R_event > (rx[1]+ n1*300)& R_event <= (rx[1] + 300*(n1+1))] //create list for each va

Re: [R] loop problem

2009-09-29 Thread David Winsemius
That code is way more than a _minimal_ example, and its not _reproducible_ either, so just a comment: Have you considered creating a vector rather than separate "event" variables? R_ev[1:16] <- R_event > (rx[1] + 300*(0:15)& R_event <= (rx[1] + 300*(1:16) ?cut # would also appear to b

[R] loop problem

2009-09-29 Thread crenial30
I have the following code which I wanted to convert using for loop previous code: R_ev1 <- R_event[R_event > (rx[1] + 300*0)& R_event <= (rx[1] + 300*1)] R_ev2 <- R_event[R_event > (rx[1] + 300*1)& R_event <= (rx[1] + 300*2)] R_ev3 <- R_event[R_event > (rx[1] + 300*2)& R_event <= (rx[1] + 300*3)]

Re: [R] loop problem for extract coefficients

2009-04-07 Thread Arien Lam
Hi Alex, On Sun, April 5, 2009 16:49, Alex Roy wrote: > Dear R users, > I have problem with extracting coefficients from a > object. Here, X (predictor)and Y (response) are two matrix , I am > regressing > X ( dimensions 10 x 20) on each of columns of Y[,1] (10 x 1) and want

Re: [R] loop problem for extract coefficients

2009-04-05 Thread Bill.Venables
x Roy Sent: Monday, 6 April 2009 12:49 AM To: r-help@r-project.org Subject: [R] loop problem for extract coefficients Dear R users, I have problem with extracting coefficients from a object. Here, X (predictor)and Y (response) are two matrix , I am regressing X ( dimensions 10 x 20)

[R] loop problem for extract coefficients

2009-04-05 Thread Alex Roy
Dear R users, I have problem with extracting coefficients from a object. Here, X (predictor)and Y (response) are two matrix , I am regressing X ( dimensions 10 x 20) on each of columns of Y[,1] (10 x 1) and want to store the coefficient values. I have performed a Elastic Net

Re: [R] loop problem

2009-03-26 Thread Jim Lemon
Muhammad Azam wrote: Dear R members I have a problem regarding storing the lists. Let L=number of distinct values of any predictor (say L=5) P=number of predictors (say P=20) g1 <- c() for(i in 1:P){ if(L > 1){ for(j in 1:(L-1)){ g <- g1[j] <- g } } g2

[R] loop problem

2009-03-26 Thread Muhammad Azam
Dear R members I have a problem regarding storing the lists. Let L=number of distinct values of any predictor (say L=5) P=number of predictors (say P=20) g1 <- c() for(i in 1:P){ if(L > 1){ for(j in 1:(L-1)){ g <- g1[j] <- g } } g2[]=sort.list(g1)

Re: [R] Loop problem

2008-07-14 Thread Gabor Grothendieck
Try this: pk[rep(1, 4), ] On Mon, Jul 14, 2008 at 4:33 AM, fernanda lopez <[EMAIL PROTECTED]> wrote: > Dear all, > I want to > write ck<-cbind(rep(pk[1,1],4),rep(pk[1,2],4),rep(pk[1,3],4)) state ment > in a loop . How can I write it ? > > > > > >> pk > [,1] [,2]

Re: [R] Loop problem

2008-07-14 Thread Daniel Malter
Hi, do you mean this? pk<-matrix(rnorm(12),nrow=4,ncol=3) ck1<-cbind(rep(pk[,1],4),rep(pk[,2],4),rep(pk[,3],4)) ## or ck2<-cbind(rep(pk[,1],each=4),rep(pk[,2],each=4),rep(pk[,3],each=4)) pk ck1 ck2 best, Daniel fernanda lopez wrote: > > Dear all, > I want to > write ck<-cbi

Re: [R] Loop problem

2008-07-14 Thread Dimitris Rizopoulos
)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: "fernanda lopez" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 14, 2008 10:33 AM Subject: [R] Loop problem Dear a

[R] Loop problem

2008-07-14 Thread fernanda lopez
Dear all, I want to write ck<-cbind(rep(pk[1,1],4),rep(pk[1,2],4),rep(pk[1,3],4)) state ment in a loop . How can I write it ? > pk [,1] [,2] [,3] [1,] -1.1354816 0.9808877 -0.9446314 [2,] 0.7787378 0.4536944 0.3204882 [3,] -1.7274907 1.5112011 1.448183

Re: [R] Loop problem

2008-03-27 Thread Jim Lemon
Oops, missed the first line of the example: storm.data<-data.frame(meas.index=10001:2,cumrain=runif(1,-10,10)+10) You can generalize the function to whatever column names you have like this: find.max.rain<-function(raindata,howmany,raincol) { # a lazy way of getting the same structure

Re: [R] Loop problem

2008-03-27 Thread Jim Lemon
Jamie Ledingham wrote: > Dear all, I have a problem with a loop, if anyone has any knowledge on > these things I would appreciate some comments. The code below is > designed to allow me to extract the top record of the data frame, and > them remove rows from the data frame which have an index clos

Re: [R] Loop problem

2008-03-26 Thread jim holtman
Basically you are moving the data up and then incrementing to the next row. Here is an example; assume that you are at the 2nd entry: 1 2 <== here 3 4 Now your loop index is 2 and you remove the current data ('2') and are left with: 1 3 <== index of 2 points here 4 Now you increment the inde

[R] Loop problem

2008-03-26 Thread Jamie Ledingham
Dear all, I have a problem with a loop, if anyone has any knowledge on these things I would appreciate some comments. The code below is designed to allow me to extract the top record of the data frame, and them remove rows from the data frame which have an index close to the extracted top record.