Re: [R] loop vs. apply(): strange behavior with data frame?

2009-10-22 Thread Roberto Perdisci
on the two examples to see what the difference is. what you will probably see is a lot of the time on the dataframe is spent in accessing it like a matrix ('['). Rprof is very helpful to see where time is spent in your scripts. Sent from my iPhone On Oct 21, 2009, at 17:17, Roberto Perdisci

[R] loop vs. apply(): strange behavior with data frame?

2009-10-21 Thread Roberto Perdisci
Hi everybody, I noticed a strange behavior when using loops versus apply() on a data frame. The example below explicitly computes a distance matrix given a dataset. When the dataset is a matrix, everything works fine. But when the dataset is a data.frame, the dist.for function written using

Re: [R] Winsorized mean and variance

2009-08-27 Thread Roberto Perdisci
This is of great help, thanks! Roberto On Thu, Aug 27, 2009 at 7:20 AM, Jim Lemonj...@bitwrit.com.au wrote: Roberto Perdisci wrote: Hello everybody,  after searching around for quite some time, I haven't been able to find a package that provides a function to compute the Windorized mean

[R] Winsorized mean and variance

2009-08-26 Thread Roberto Perdisci
Hello everybody, after searching around for quite some time, I haven't been able to find a package that provides a function to compute the Windorized mean and variance. Also I haven't found a function that computes the trimmed variance. Is there any such package around? thanks, Roberto

Re: [R] Help with K-means Clustering

2007-11-15 Thread Roberto Perdisci
Hi, if you use the function kmean in the package stats, for example clust - kmeans(data, k, iter.max = 10) where k is the number of desired cluster, kmeans will choose the first k centers randomly. Because of this random initialization, after iter.max iteration the solution may converge to