[R] Random data

Dimitris Rizopoulos d.rizopoulos at erasmusmc.nl
Wed Nov 25 16:08:05 CET 2009


one way is:

x <- sort(rnorm(100))
y <- rnorm(100, mean = x, sd = 0.3)

plot(x, y)
abline(a = 0, b = 1)


I hope it helps.

Best,
Dimitris


mentor_ wrote:
> Hi,
> 
> how can I produce random data which lies around a straight line with angle
> 45 degree.
> Similar to this image: http://zoonek2.free.fr/UNIX/48_R/g134.png
> 
> Cheers

-- 
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




More information about the R-help mailing list