Re: [R] nested loop

2017-09-09 Thread Ek Esawi
I would try fininterval as well. It should do what you have asked provided that you take care of the issue Ulrik pointed out. Best of luck--EK On Fri, Sep 8, 2017 at 6:15 AM, Hemant Sain wrote: > i have a vector containing values ranging from 0 to 24 > i want to create another variable which can

[R] nested loop

2017-09-08 Thread Hemant Sain
i have a vector containing values ranging from 0 to 24 i want to create another variable which can categorize those values like this please help me with an R code Thanks *Value New_Var*10 -5 30 -5 50 -5 96-10 76-10 56-

Re: [R] Nested loop R code

2017-09-08 Thread Ulrik Stervbo
Hi Hemant, please write to the r-help list in the future. Look at the cut () function to solve your problem. Also, you have a problem in your example - 5 is placed in two different categories. HTH Ulrik On Fri, 8 Sep 2017 at 12:16 Hemant Sain wrote: > i have a vector containing values rangin

Re: [R] Nested loop and output help

2013-02-08 Thread PIKAL Petr
go through R intro document (chapter 2 and chapter 9). You probably could find answer yourself quicker then waiting for me to answer it. Regards Petr From: staysafe23 [mailto:staysaf...@gmail.com] Sent: Thursday, February 07, 2013 9:09 PM To: PIKAL Petr Subject: RE: [R] Nested loop and output help

Re: [R] Nested loop and output help

2013-02-06 Thread PIKAL Petr
ch cycle you assign whole vector oo1 to dev1. Is it intended? Regards Petr From: staysafe23 [mailto:staysaf...@gmail.com] Sent: Friday, February 01, 2013 10:12 PM To: PIKAL Petr Cc: r-help@r-project.org Subject: RE: [R] Nested loop and output help Thank you very much Petr, I believe I have fixed m

Re: [R] Nested loop and output help

2013-02-02 Thread staysafe23
cor(X2,Y2) > > lll[["mat2"]] <-cbind(X2,Y2) > > a11 <- ifelse( X < lll[["cut1"]] & Y < lll[["cut2"]], 1, 0) > > a12 <- ifelse( X < lll[["cut1"]] & Y >= lll[["cut2"]], 1, 0) > > a21 <- ifelse

Re: [R] Nested loop and output help

2013-02-01 Thread staysafe23
t;cut1"]] & Y >= lll[["cut2"]], 1, 0) a21 <- ifelse( X >= lll[["cut1"]] & Y < lll[["cut2"]], 1, 0) a22 <- ifelse( X >= lll[["cut1"]] & Y >= lll[["cut2"]], 1, 0) lll[["mat3"]] <-matrix(c(sum(a11),sum

Re: [R] Nested loop and output help

2013-02-01 Thread PIKAL Petr
Hi see inline > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of staysafe23 > Sent: Friday, February 01, 2013 1:01 AM > To: r-help@r-project.org > Subject: [R] Nested loop and output help > > Hello E

Re: [R] nested loop for

2011-07-22 Thread paloma ruiz benito
eric() for (i in 1:length(data.aux$Pma)){ result.aux[i] <-sum(data.aux$SBA2[which(data.aux$dbh2> data.aux[i , ]$dbh2)]) } data$BAL2[ index.stand]<-result.aux rm(data.aux) rm(result.aux) } data Best, Paloma > Date: Thu, 21 Jul 2011 14:18:37 -0700

Re: [R] nested loop for

2011-07-21 Thread Dennis Murphy
Hi: I *think* this is what you're after, but I get dizzy trying to read convoluted loops. Try this instead; # Function to find the total SBA2 for all dbh2 larger than the given one: foo <- function(d) { d <- d[order(d$dbh2), ] d <- transform(d, BAL2 = sum(SBA2) - cumsum(SBA2)) d }

[R] nested loop for

2011-07-21 Thread paloma ruiz benito
Hi everyone, I have been working some days in a nested loop in R but I can't find the solution. I have a data.frame with an unique ID for individuals and unique ID for different stands, for each indiviadual I have a dbh record and a SBA (stand basal area) field. Pma<-rep (1:40) P<-seq(1,4,

[R] Nested loop ok now. Thanks to you all

2007-09-18 Thread Riddle Chin
Thanks, Julian, Phil and Erin. I have solved the problem. Riddle. - [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read