[R] custom metric for dist for use with hclust/kmeans

2010-05-07 Thread Vivek Ayer
-- Forwarded message -- From: Vivek Ayer Date: Fri, May 7, 2010 at 10:17 AM Subject: Re: [R] custom metric for dist for use with hclust/kmeans To: Greg Snow Hi Greg, The pam function is exactly what I needed. I can now create my own distance matrix, run as.dist on it and pass

Re: [R] custom metric for dist for use with hclust/kmeans

2010-05-06 Thread Vivek Ayer
Bump...no insights on defining custom metrics. Guess I'll give the other languages a shot. Vivek On Wed, May 5, 2010 at 10:13 AM, Vivek Ayer wrote: > Hi guys, > > I've been using the kmeans and hclust functions for some time now and > was wondering if I could specif

[R] custom metric for dist for use with hclust/kmeans

2010-05-05 Thread Vivek Ayer
Hi guys, I've been using the kmeans and hclust functions for some time now and was wondering if I could specify a custom metric when passing my data frame into hclust as a distance matrix. Actually, kmeans doesn't even take a distance matrix; it takes the data frame directly. I was wondering if th

Re: [R] dopar parallel assignments

2010-04-29 Thread Vivek Ayer
(paste("test_",v[i],sep=""),test[[i]]) > > In your specific example, > >  some_timeconsuming_function <- function(i) i > > but that's not timeconsuming, and so you're not going to get any > benefit from parallelization. > > # David Sm

[R] dopar parallel assignments

2010-04-29 Thread Vivek Ayer
Hi guys, I was wondering why this piece of code doesn't work: foreach (i = c(1.25,1.50)) %dopar% { assign(paste("test_",i,sep=""),i) } but, this does: foreach (i = c(1.25,1.50)) %do% { assign(paste("test_",i,sep=""),i) } Obviously, the difference is %dopar% vs. %do%. If I use %do%, I get objec

[R] other methods for dist()?

2010-04-28 Thread Vivek Ayer
Hi all, I was wondering if there's a way to specify other metrics for the method for the dist command other than the standard euclidean, manhattan, canberra, etc. Specifically, I'd to generate a distance matrix using the metrics from information theory, e.g., KL-divergence or something similar to

Re: [R] scatterplot3d bug??

2009-08-25 Thread Vivek Ayer
Great! Thanks again! Vivek 2009/8/25 Uwe Ligges : > I finally found some time to look at it: > > Yes, it does not work properly for angles > 180 degrees. Will try to find a > fix and make a new release soon. > > Best wishes, > Uwe Ligges > > > Vivek Ayer wrote:

[R] Point-to-point Truncation with truncreg possible?

2009-08-13 Thread Vivek Ayer
Hi all, Can you use the truncreg() function to do point-to-point truncation, i.e., specify a different point=, for each point in your dataset. I guess in that sense this would be a nonlinear fit. Thanks, Vivek __ R-help@r-project.org mailing list https

Re: [R] For Loop Iteration: Variable Counter

2009-08-03 Thread Vivek Ayer
Got it..Thanks Vivek On Mon, Aug 3, 2009 at 9:13 AM, Steve Lianoglou wrote: > Hi, > > On Aug 3, 2009, at 12:09 PM, Vivek Ayer wrote: > >> Hey guys, >> >> How do I iterate such that I add 100 to the counter every time? >> >> Suppose: for (i in c(

[R] For Loop Iteration: Variable Counter

2009-08-03 Thread Vivek Ayer
Hey guys, How do I iterate such that I add 100 to the counter every time? Suppose: for (i in c(1:100)) I want i to be 1, 10, 20, 30, ... instead of 1,2,3,4,5 ... How can this be done? Thanks, Vivek __ R-help@r-project.org mailing list https://stat.e

Re: [R] Looping through R objects with $ operator and tags

2009-07-30 Thread Vivek Ayer
but it's usually not a good idea in R to have to > paste together strings to access a variable. >                                               - Phil > > > On Thu, 30 Jul 2009, Vivek Ayer wrote: > >> How I loop object placement into a list? >> >> for (i in c(1:10)) >> list(paste("obje

Re: [R] Looping through R objects with $ operator and tags

2009-07-30 Thread Vivek Ayer
t <- c(TotLogDist,objecti$LogDist) After this, I don't need to do anymore loops etc. I promise I'll use lists, lapply, and sapply from then on. Thanks, Vivek On Thu, Jul 30, 2009 at 9:04 AM, Vivek Ayer wrote: > Hi all, > > Suppose I want to set the values in a column to the lo

[R] Looping through R objects with $ operator and tags

2009-07-30 Thread Vivek Ayer
Hi all, Suppose I want to set the values in a column to the log of the values of another column like so: object$LogDist <- log10(object$Distance) How do I loop through the objects if I have object1, object2, etc to perform this function? object1$LogDist <- log10(object1$Distance) object2$LogDis

Re: [R] Looping through R objects

2009-07-28 Thread Vivek Ayer
UE)) in shorthand: for {assign(paste,read(paste))} This creates individual objects for each csv file and allows me to have $ subjects, e.g., bc1$foo. Thanks again, Vivek On Tue, Jul 28, 2009 at 2:12 PM, Steve Lianoglou wrote: > Hi, > > On Jul 28, 2009, at 4:54 PM, Vivek Ayer wrote: > >>

[R] Looping through R objects

2009-07-28 Thread Vivek Ayer
Hi all, I have 13 csv files and I want to assign each csv file to one object, i.e., bc1 <- read.csv("1.csv,header=TRUE,sep="") bc2 <- read.csv("2.csv,header=TRUE,sep="") bc3 ... So I want to create 13 objects. How could I automate this with a for loop? for (i in c(1:13)) ... Any ideas? Thanks

[R] Double Truncation Fit??

2009-07-27 Thread Vivek Ayer
Hey guys, Do you all know of a function that provides fitting for double-sided truncation? truncreg accounts for one-sided truncation, but not two, or at least I don't how to. Our outlier values are -115 on the left side and -55 on the right. Help appreciated, Vivek _

Re: [R] Colors column don't give correct color with plot()

2009-07-24 Thread Vivek Ayer
; > its because d[,3] is a factor. > > Or in read.csv: > > d <- read.csv("blah.csv",header=FALSE,sep="", stringsAsFactor = FALSE) > > On Fri, Jul 24, 2009 at 3:23 PM, Vivek Ayer wrote: >> >> Hey guys, >> >> I'm having trouble ge

[R] Colors column don't give correct color with plot()

2009-07-24 Thread Vivek Ayer
Hey guys, I'm having trouble getting the correct colors, when they are read from a csv file. Here's an example: 1 1 black 1 2 green 1 3 green 1 4 black 1 5 peachpuff Call it blah.csv. Then I ran: data <- read.csv("blah.csv",header=FALSE,sep="") and then to plot the data, I ran: plot(data[,1],

[R] Colors column don't give correct color with plot()

2009-07-24 Thread Vivek Ayer
Hey guys, I'm having trouble getting the correct colors, when they are read from a csv file. Here's an example: 1 1 black 1 2 green 1 3 green 1 4 black 1 5 peachpuff Call it blah.csv. Then I ran: data <- read.csv("blah.csv",header=FALSE,sep="") and then to plot the data, I ran: plot(data[,1],

[R] Symmetrically Trimmed Least Squares (STLS) Regression Analysis Help

2009-07-22 Thread Vivek Ayer
Hi all, Just started using R recently. Got OLS and Truncated Regression to work via lm() and truncreg(). But we need to use STLS for our data. Is there a function out there that does this, or can we use a clever workaround using what we already have? Thanks in advance, Vivek Ayer