[R] Decimal series how to make.........
Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) thanks in advance ANIL KUMAR( METEOROLOGIST) LRF SECTION NATIONAL CLIMATE CENTER ADGM(RESEARCH) INDIA METEOROLOGICAL DEPARTMENT SHIVIJI NAGAR PUNE-411005 INDIA MOBILE +919422023277 [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Decimal series how to make.........
On 14 Jun 2006, anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, You want the seq() function. Look it up by typing ?seq About the : - watch out for the difference between 1:4-1 and 1:(4-1) (Go ahead and try) best Niels i want to use this varible in for loop.. like for(j in s) thanks in advance ANIL KUMAR( METEOROLOGIST) LRF SECTION NATIONAL CLIMATE CENTER ADGM(RESEARCH) INDIA METEOROLOGICAL DEPARTMENT SHIVIJI NAGAR PUNE-411005 INDIA MOBILE +919422023277 [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Decimal series how to make.........
?seq anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) thanks in advance ANIL KUMAR( METEOROLOGIST) LRF SECTION NATIONAL CLIMATE CENTER ADGM(RESEARCH) INDIA METEOROLOGICAL DEPARTMENT SHIVIJI NAGAR PUNE-411005 INDIA MOBILE +919422023277 [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Decimal series how to make.........
On 14-Jun-06 anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) As well as the use of 'seq' which other have suggested, a nice clean technique is s - 0.1*(0:10) which also is easier to type than s - seq(0,1,by=0.1) Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 14-Jun-06 Time: 10:05:56 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Decimal series how to make.........
On 6/14/06, Ted Harding [EMAIL PROTECTED] wrote: On 14-Jun-06 anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) As well as the use of 'seq' which other have suggested, a nice clean technique is s - 0.1*(0:10) which also is easier to type than s - seq(0,1,by=0.1) or 0:10/10 which is even easier to type although perhaps not as clear. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Decimal series how to make.........
On 14-Jun-06 Gabor Grothendieck wrote: On 6/14/06, Ted Harding [EMAIL PROTECTED] wrote: On 14-Jun-06 anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) As well as the use of 'seq' which other have suggested, a nice clean technique is s - 0.1*(0:10) which also is easier to type than s - seq(0,1,by=0.1) or 0:10/10 which is even easier to type although perhaps not as clear. On those lines, I'd settle for (0:10)/10 -- I always make a point of putting ranges like 0:10 in (...) since there are too many traps for the unwary. Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 14-Jun-06 Time: 14:46:24 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Decimal series how to make.........
I agree although if you use this construct a lot then you will likely want to adopt the easier-to-write 0:10/10 style as an idiom. I find this is particularly the case with rq from the quantreg package where its convenient to use it in specifying the tau= arg: library(quantreg) data(engel) rq(y ~ x, data = engel, tau = 1:9/10) On 6/14/06, Ted Harding [EMAIL PROTECTED] wrote: On 14-Jun-06 Gabor Grothendieck wrote: On 6/14/06, Ted Harding [EMAIL PROTECTED] wrote: On 14-Jun-06 anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) As well as the use of 'seq' which other have suggested, a nice clean technique is s - 0.1*(0:10) which also is easier to type than s - seq(0,1,by=0.1) or 0:10/10 which is even easier to type although perhaps not as clear. On those lines, I'd settle for (0:10)/10 -- I always make a point of putting ranges like 0:10 in (...) since there are too many traps for the unwary. Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 14-Jun-06 Time: 14:46:24 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html