One option, first, generate the range of "x" data that you want, then add normally distributed noise to each x, these will be your "y" data.
n <- 20 x <- sample(20:50, n) y <- rnorm(n, mean = x, sd = 3) plot(y ~ x) Erik > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of mentor_ > Sent: Wednesday, November 25, 2009 8:43 AM > To: r-help@r-project.org > Subject: [R] Random data > > > 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 > -- > View this message in context: http://old.nabble.com/Random-data- > tp26513822p26513822.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. ______________________________________________ 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.