Re: [R] repeat a function

2017-11-03 Thread Eric.Pueyo
Thanks Petr. Really appreciated! Many thanks, Eric -Original Message- From: PIKAL Petr [mailto:petr.pi...@precheza.cz] Sent: 03 November 2017 07:54 To: Eric Pueyo; r-help@r-project.org Subject: RE: [R] repeat a function Hi Well, I am not an expert in this field so I cannot comment

Re: [R] repeat a function

2017-11-03 Thread PIKAL Petr
om: eric.pu...@avivainvestors.com [mailto:eric.pu...@avivainvestors.com] > Sent: Thursday, November 2, 2017 5:54 PM > To: PIKAL Petr ; r-help@r-project.org > Subject: RE: [R] repeat a function > > Hi Petr, > > Many thanks for your response. > > Basically I want to create a pr

Re: [R] repeat a function

2017-11-02 Thread Eric.Pueyo
j,sep = ""),"1"] <<- ProbUP(a,j,dt) prb[paste(j,sep = ""),"0"] <<- ProbMID(a,j,dt) prb[paste(j,sep = ""),"-1"] <<- ProbDWN(a,j,dt) prb[paste(-j,sep = ""),"1"] <<- ProbUP(a,-j,d

Re: [R] repeat a function

2017-11-02 Thread Bert Gunter
easily transform it to > matrix by setting dim argument to it. > > Cheers > Petr > > > -Original Message- > > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > > eric.pu...@avivainvestors.com > > Sent: Wednesday, November 1, 2017 1:31

Re: [R] repeat a function

2017-11-02 Thread PIKAL Petr
s Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > eric.pu...@avivainvestors.com > Sent: Wednesday, November 1, 2017 1:31 PM > To: r-help@r-project.org > Subject: [R] repeat a function > > I want to populate the matrix prb t

[R] repeat a function

2017-11-01 Thread Eric.Pueyo
I want to populate the matrix prb through the function HWMProb <- function (a,j,dt) that encapsulates different functions (please see code below), using j= 0:2 for each j. It only populates prb if I specify each function independently in the global environment and then run the loop with the iF

Re: [R] repeat a function

2010-09-29 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Michael Bedward > Sent: Wednesday, September 29, 2010 5:34 PM > To: Michael Larkin; Rhelp > Subject: Re: [R] repeat a function > > On 30 September 20

Re: [R] repeat a function

2010-09-29 Thread Michael Bedward
On 30 September 2010 02:48, Michael Larkin wrote: > > > > testdat <- replicate( 50, growth[ sample(nrow(growth), 8, rep=TRUE) ] ) > > I can't seem to get it to work.  I keep getting the error message of > "undefined columns selected" > > Any advice? I'd need to know the dimensions of your matrix

Re: [R] repeat a function

2010-09-28 Thread Michael Bedward
Hi Michael testdat <- replicate( 50, growth[ sample(nrow(growth), 8, rep=TRUE) ] ) testdat will then be a matrix of 8 x 50 = 400 rows where each lot of 8 is a sample. Alternatively you can do... testdat <- replicate( 50, growth[ sample(nrow(growth), 8, rep=TRUE) ], simplify=FALSE ) Now testdat

[R] repeat a function

2010-09-28 Thread Michael Larkin
I have R randomly sampling my array made up of 2 columns of data. Here is my code randomly sampling 5 different rows from my dataset to create a new dataset of 8 rows of data: testdat<-growth[sample(5,8,replace=T),] Now I want to tell R to repeat this function 50 times and give me the