[R] Applying a loop with rnorm() to eliminate duplicate coordinates in a dataframe object

From: Ricardo Bandin <rbandin_at_gmail.com>
Date: Wed, 05 Nov 2008 16:19:25 -0300

Dear colleagues

I found duplicate coordinates trying to convert a dataframe object (see the attached file) into a geodata one ('geoR' package is needed). My dataframe object consists of 2 columns with UTM geographical coordinates and a 3rd column with fish densities .

To overcome the handicap I must add a tiny value generated by rnorm() to each geographical coordinate. And it must be in a loop, otherwise the added value will be the same for all the coordinates, persisting the duplicates. The example given to me was:
for (i in 1: length(x$coords[1]) { x$coords[1]+rnorm(1,0,1) }

But I still can not understand this instruction syntaxis. I'll be very grateful if somebody can teach me.

Thanks for your attention,

Ricardo Bandin Llanos
Estudiante - Magíster Cs. m. Pesquerías
Universidad de Concepción, Región del Bio-Bio, Chile
Celular: (0056-41) 97949957

______________________________________________ R-help_at_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.

Received on Wed 05 Nov 2008 - 19:23:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 05 Nov 2008 - 22:30:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive