Skip to content
Back to formatted view

Raw Message

Message-ID: <404C8749-1892-4F16-8F90-195CF3BFD21B@xs4all.nl>
Date: 2012-10-10T15:13:25Z
From: Berend Hasselman
Subject: Generating random geographical coordinates
In-Reply-To: <507582E8.6060709@cnam.fr>

On 10-10-2012, at 16:15, Poizot Emmanuel <emmanuel.poizot at cnam.fr> wrote:

> Dear all,
> 
> I have two coordinates vectors, say X and Y of length n.
> I want to generate for each couple of coordinates X1,Y1 X2,Y2 X3,Y3....Xn,Yn a random coordinate which is located in a square define as X +/- dx and Y +/- dy.
> I saw the runif function which can generate for just one value at a time what I want  : runif(1, X - dx, X + dx) for X and runif(1, Y - dy, Y + dy) for Y.
> I would like to know if there is not a more powerfull way in R to generate directly the set of random coordinates.

Yes there is. Just do

?runif

to get help on runif.

Berend