Re: [R] looping problem

2017-02-02 Thread greg holly
ginal Message- > > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of greg > holly > > Sent: Thursday, February 2, 2017 4:13 PM > > To: Rui Barradas <ruipbarra...@sapo.pt> > > Cc: r-help mailing list <r-help@r-project.org> > > Subject: Re: [R

Re: [R] looping problem

2017-02-02 Thread PIKAL Petr
p mailing list <r-help@r-project.org> > Subject: Re: [R] looping problem > > Thanks so much for this. Unfortunately, cbind did not work. Basically, I like > to > put an extra column named "chr" in the combined file from 22 chr. > So chr colum will be "1" for the

Re: [R] looping problem

2017-02-02 Thread greg holly
Thanks so much for this. Unfortunately, cbind did not work. Basically, I like to put an extra column named "chr" in the combined file from 22 chr. So chr colum will be "1" for the portion of chr1 in the combined file, 2 for the portion of chr2 in the combined file and so on. Regards, Greg On

Re: [R] looping problem

2017-02-02 Thread Rui Barradas
Hello, If I understand correctly, just use ?cbind. Rui Barradas Em 02-02-2017 13:33, greg holly escreveu: Hi Rui; Is there any way to insert the chr ids in numeric as 1,2..,22 in the final output. Here is output from str(temp). So I need also chr ids in a column. 1 rs58108140

Re: [R] looping problem

2017-02-02 Thread greg holly
Hi Rui; Is there any way to insert the chr ids in numeric as 1,2..,22 in the final output. Here is output from str(temp). So I need also chr ids in a column. 1 rs58108140 10583 G A -0.070438 0.059903 2 rs189107123 10611 C G -0.044916 0.085853 Regards, Greg On Wed, Feb 1,

Re: [R] looping problem

2017-02-01 Thread greg holly
Hi Rui; I do appreciate for this. Thanks so much. I will try ASAP. Regards, Greg On Wed, Feb 1, 2017 at 1:32 PM, Rui Barradas wrote: > Hello, > > If what you want is to combine the files into one data.frame then there > are 2 things you should see: > > 1) You create a

Re: [R] looping problem

2017-02-01 Thread Rui Barradas
Hello, If what you want is to combine the files into one data.frame then there are 2 things you should see: 1) You create a variable named 'temp' and don't ever use it. 2) You never combine the data.frames you read in. Try instead the following. temp <- data.frame() for(i in 1:22) {

[R] looping problem

2017-02-01 Thread greg holly
Hi all; I have 22 directories named chr1, chr2,,chr22. Each directory has a file named "Z-score.imputed". I would like to combine Z-score.imputed files into one. I wrote the following loop but did not get any results. Your helps are highly appreciated. regards, Greg temp<-c() for(i in

[R] Looping Problem

2011-03-22 Thread armstrwa
Hi all, I am trying to write a script that will automate the task of running a Kendall's Tau correlation test on 75 time series that I am interested in. The code I have written is: for(i in 1:length(gagehandles)){ dates-get(paste(gagehandles[i],_amsd,sep=))

Re: [R] Looping Problem

2011-03-22 Thread Dieter Menne
armstrwa wrote: for(i in 1:length(gagehandles)){ dates-get(paste(gagehandles[i],_amsd,sep=)) Error in get(paste(gagehandles[i], _amsd, sep = )) : variable names are limited to 256 bytes It didn't have a problem with the variable names before, so I'm not sure what's going on

Re: [R] LOOping problem with R

2010-08-30 Thread David Winsemius
On Aug 30, 2010, at 1:27 AM, Nam Lethanh wrote: Dear Guys, I do converting codes from Fortran into R and got stuck in solving LOOPING procedure with R. In FORTRAN, it is (DO and END DO) for looping in the net. In R, it is (FOR with { }). Looking at the results (namely the 1's from

Re: [R] LOOping problem with R

2010-08-30 Thread Mario Valle
When j==1 for loops from i down to zero. 5:0 is valid and means c(5,4,3,2,1,0) Hope it helps mario Nam Lethanh wrote: Dear Guys, I do converting codes from Fortran into R and got stuck in solving LOOPING procedure with R. In FORTRAN, it is (DO and END DO) for looping

Re: [R] LOOping problem with R

2010-08-30 Thread Joshua Wiley
Hi, I would also like to point out that you flipped the first two the values of theta in the R vs. FORTRAN versions. This fixes part of your differences (and makes it easy to see that the differences occur when j i, as David and Mario point out). Josh On Sun, Aug 29, 2010 at 10:27 PM, Nam

Re: [R] LOOping problem with R

2010-08-30 Thread Berend Hasselman
You made a mistake with theta theta-c(0.08,0.06,0.09,0) This should be (see the fortran) theta-c(0.06,0.08,0.09,0) The innermost loop (for( k in ...) is better written as while loop to take into account how Fortran handles loops (see the previous replies): k - i while( k =

[R] LOOping problem with R

2010-08-29 Thread Nam Lethanh
Dear Guys, I do converting codes from Fortran into R and got stuck in solving LOOPING procedure with R. In FORTRAN, it is (DO and END DO) for looping in the net. In R, it is (FOR with { }). I believe there is something wrong with my coding in R, do hope that you can help me solving following

[R] looping problem

2010-02-12 Thread Roslina Zakaria
Hi r-users,   I have this code below but I don't understand the error message:   cumdensity - function(z) { alp  - 2.0165;   rho  - 0.868;   # simplified expressions   a  - alp-0.5   c1 - sqrt(pi)/(gamma(alp)*(1-rho)^alp)   c2 - sqrt(rho)/(1-rho)   t1 - exp(-z/(1-rho))   t2     -

Re: [R] looping problem

2010-02-12 Thread jim holtman
Exactly what are you expecting the 'if' statement to do? By definition, the 'if' only takes a single value and your expression is probably a vector with many values and the error message is just saying it will use only the first value to determine what to do. Are you trying to check if 'any' or

[R] looping problem

2010-02-09 Thread Roslina Zakaria
Hi R-users,   I have this code here: library(numDeriv)   fprime - function(z) { alp  - 2.0165;   rho  - 0.868;   # simplified expressions   a  - alp-0.5   c1 - sqrt(pi)/(gamma(alp)*(1-rho)^alp)   c2 - sqrt(rho)/(1-rho)   t1 - exp(-z/(1-rho))   t2 - (z/(2*c2))^a   bes1   -

[R] looping problem

2009-06-23 Thread Roslina Zakaria
Hi R-users,   I have this code below and use some code from sn package for multivariate skew t (rmst) to generate a set of random numbers.   I try to do a looping to produce ‘rand’ for different values of degrees of freedom (degf).  Actually, I’m not sure how to specify the

[R] looping problem

2008-04-24 Thread Roslina Zakaria
Dear r-expert, I would like to generate 30 sets of random numbers from uniform distribution (0,1). Each set of random numbers should have 90 data.  Here is my code: rand.no - function(n,itr) { for (i in 1:itr)   {rand.1 - runif(n,0,1)   if (i ==1) rand.2 - rand.1   else rand.2 -

Re: [R] looping problem

2008-04-24 Thread Uwe Ligges
Roslina Zakaria wrote: Dear r-expert, I would like to generate 30 sets of random numbers from uniform distribution (0,1). Each set of random numbers should have 90 data. Here is my code: rand.no - function(n,itr) { for (i in 1:itr) {rand.1 - runif(n,0,1) if (i ==1) rand.2 - rand.1

Re: [R] looping problem

2008-04-14 Thread Richard . Cotton
I would like to do looping for this process below to estimate alpha beta from gamma distribution: Here are my data: day_data1 - 123456 789 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1943 48.3 18.5 0.0 0.0 18.3 0.0 0.0

[R] looping problem

2008-04-13 Thread Roslina Zakaria
Hi R-users, I would like to do looping for this process below to estimate alpha beta from gamma distribution: Here are my data: day_data1 - 123456 789 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1943 48.3 18.5 0.0 0.0 18.3 0.0