From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>

Date: Tue 01 Aug 2006 - 18:17:40 EST

*>
*

*> ______________________________________________
*

*> R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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 Tue Aug 01 18:28:03 2006

Date: Tue 01 Aug 2006 - 18:17:40 EST

Jose Andres wrote:

> Hi all,

*>
**> I am trying to generate a distribution for the mean euclidean
**> distance between a group of n elements in a given surface (the
**> elements are randomly picked). Fo doing so I've written the
**> following code:
**>
**> sampling<- function(x,size) {
**>
**> x<- x[sample(1:nrow(x),size),]
**>
**> mat<- matrix(c(x$V6,x$V7,x$V8), ncol=3)
**>
**> mean.dist<- mean(dist(mat,"euclidean"))
*

# insert some return value such as:

return(mean.dist)

*> }
*

Now replicate() the stuff, e.g.:

replicate(10000, sampling(x, 10))

Uwe Ligges

> x is the file where the data are stored

*> size is the size of the group
**> mat generates a simple matrix. V6, V7, and V8 are the 3D (x,y,z)
**> coordinates of the group elements .
**> mean.dist calculates the mean pairwise distance between the objects
**> of the group.
**>
**> Everything works fine but I want to repeat this many times (e.g.
**> 10000) and store the mean.dist values in a new variable so I can
**> generate the distribution of mean pairwise distances of a group of
**> size n in my surface.
**>
**> Is there any easy way to do this? I'd really appreciate all your
**> comments.
**>
**> Thanks in advance,
**>
**> /Jose
**>
**>
**>
**>
**>
**>
**>
**>
**>
**>
**> On Jul 31, 2006, at 15:35, Prof Brian Ripley wrote:
**>
*

>> On Mon, 31 Jul 2006, Sundar Dorai-Raj wrote: >> >>> >>> LL wrote: >>>> Hi.. I am running R version 2.3.1 on a Windows XP machine with >>>> the latest Miktex 2.5 installed. I get no errors from R when >>>> running the Sweave example, >>>> >>>> testfile <- system.file("Sweave", "Sweave-test-1.Rnw", package = >>>> "utils") >>>> >>>> However, when I tex the resulting .tex file (after installing >>>> a4.sty) I get the error below. >>>> >>>> This is pdfeTeX, Version 3.141592-1.30.6-2.2 (MiKTeX 2.5 RC 1) >>>> entering extended mode >>>> (Sweave-test-1.tex >>>> LaTeX2e <2005/12/01> >>>> Babel <v3.8g> and hyphenation patterns for english, dumylang, >>>> nohyphenation, ge >>>> rman, ngerman, french, loaded. >>>> ("C:\Program Files\MiKTeX 2.5\tex\latex\base\article.cls" >>>> Document Class: article 2005/09/16 v1.4f Standard LaTeX document >>>> class >>>> ("C:\Program Files\MiKTeX 2.5\tex\latex\base\size10.clo")) >>>> ("C:\Program Files\MiKTeX 2.5\tex\latex\ltxmisc\a4wide.sty" >>>> ("C:\Program Files\MiKTeX 2.5\tex\latex\ntgclass\a4.sty")) >>>> ! Missing \endcsname inserted. >>>> <to be read again> >>>> \protect >>>> l.11 \begin >>>> {document} >>>> ? >>>> [[alternative HTML version deleted]] >>>> >>>> ______________________________________________ >>>> R-help@stat.math.ethz.ch 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. >>> >>> This works for me. However, when I ran this, MiKTeX prompted me to >>> install the ntgclass package, which I did. Everything ran smoothly >>> after >>> that. I'm using R-2.3.1 with MiKTeX 2.4 in WinXP Pro. >> But he is using MiKTeX 2.5: looks like a problem with MiKTeX, as >> the latex >> error is in the initial processing. >> >> -- >> Brian D. Ripley, ripley@stats.ox.ac.uk >> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ >> University of Oxford, Tel: +44 1865 272861 (self) >> 1 South Parks Road, +44 1865 272866 (PA) >> Oxford OX1 3TG, UK Fax: +44 1865 272595 >> >> ______________________________________________ >> R-help@stat.math.ethz.ch 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.

> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

> and provide commented, minimal, self-contained, reproducible code.

R-help@stat.math.ethz.ch 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 Tue Aug 01 18:28:03 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Tue 01 Aug 2006 - 20:17:43 EST.

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