Re: [R] create sequence of numbers

2010-10-22 Thread Tal Galili
Hi Alex,
Could you give us the values you used, by providing the output of:

dput(CRagent[[1]]$xy[1])
dput(CRagent[[2]]$xy[1])

?


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Fri, Oct 22, 2010 at 11:58 AM, Alaios ala...@yahoo.com wrote:

 Hello.
 I want to create some sequence of numbers . So far I used sequence which
 does
 not work always

 seq(CRagent[[1]]$xy[1],CRagent[[2]]$xy[1],by=0.01)
 Error in seq.default(CRagent[[1]]$xy[1], CRagent[[2]]$xy[1], by = 0.01) :
  wrong sign in 'by' argument
 Calls: seq - seq.default


 if the parameters are in descending form.


 The ideal would be to be able to use seq like this

 seq(2,3,by=0.5) -- 2,2.5,3
 seq(3,2,by=0.5)--3,2.5,2

 Could you please help me implement this?

 I wouldl ike to thank you in advance for your help

 Best Regards
 Alex



[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] create sequence of numbers

2010-10-22 Thread Dimitris Rizopoulos

one way is to use the sign() function, e.g.,

a - 2
b - 3
seq(a, b, by = sign(b-a)*0.5)

a - 3
b - 2
seq(a, b, by = sign(b-a)*0.5)


I hope it helps.

Best,
Dimitris


On 10/22/2010 11:58 AM, Alaios wrote:

Hello.
I want to create some sequence of numbers . So far I used sequence which does
not work always

seq(CRagent[[1]]$xy[1],CRagent[[2]]$xy[1],by=0.01)
Error in seq.default(CRagent[[1]]$xy[1], CRagent[[2]]$xy[1], by = 0.01) :
   wrong sign in 'by' argument
Calls: seq -  seq.default


if the parameters are in descending form.


The ideal would be to be able to use seq like this

seq(2,3,by=0.5) --  2,2.5,3
seq(3,2,by=0.5)--3,2.5,2

Could you please help me implement this?

I wouldl ike to thank you in advance for your help

Best Regards
Alex



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
Web: http://www.erasmusmc.nl/biostatistiek/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.