Re: [R] Finding overlaps in vector

2007-12-22 Thread Johannes Graumann
But cutree does away with the indexes from the original input, which rect.hclust retains. I will have no other choice and match that input with the 'values' contained in the clusters ... Joh Gabor Grothendieck wrote: If we don't need any plotting we don't really need rect.hclust at all.

Re: [R] Diagonal matrix with off diagonal elements

2007-12-22 Thread Peter Dalgaard
Chris Stubben wrote: Also try the odiag function in the demogR package odiag( 1:5, -1) [,1] [,2] [,3] [,4] [,5] [,6] [1,]000000 [2,]100000 [3,]020000 [4,]003000 [5,]0004

Re: [R] Efficient way to find consecutive integers in vector?

2007-12-22 Thread Martin Maechler
TP == Tony Plate [EMAIL PROTECTED] on Fri, 21 Dec 2007 18:17:18 -0700 writes: TP Martin Maechler wrote: MS == Marc Schwartz [EMAIL PROTECTED] on Thu, 20 Dec 2007 16:33:54 -0600 writes: MS On Thu, 2007-12-20 at 22:43 +0100, Johannes Graumann wrote: Hi all,

Re: [R] matrix to gal object

2007-12-22 Thread Roger Bivand
bernardo lagos alvarez blacertain at gmail.com writes: useR's I need transform the matrix wdat [,1] [,2] [,3] [,4] [,5] [,6] [1,]010110 [2,]100110 [3,]000011 [4,]110010 [5,]1

Re: [R] Finding overlaps in vector

2007-12-22 Thread Johannes Graumann
Here's what I finally came up with. Thanks for your help! Joh MQUSpotOverlapClusters - function( Series,# Vector of data to be evaluated distance=0.5,# Maximum distance of clustered data points minSize=2# Minimum size of clusters returned ){

Re: [R] Finding overlaps in vector

2007-12-22 Thread David Winsemius
Johannes Graumann [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: But cutree does away with the indexes from the original input, which rect.hclust retains. I will have no other choice and match that input with the 'values' contained in the clusters ... If you want to retain the original

Re: [R] Finding overlaps in vector

2007-12-22 Thread Gabor Grothendieck
If you want indexes, i.e. 1, 2, 3, ... instead of the values in v you can still use split -- just split on seq_along(v) instead of v (or if v had names you might want to split along names(v)): split(seq_along(v), ct) and if you only want to retain groups with 2+ elements then you can just Filter

Re: [R] Finding overlaps in vector

2007-12-22 Thread Johannes Graumann
Enlightening. Thanks. Joh Gabor Grothendieck wrote: If you want indexes, i.e. 1, 2, 3, ... instead of the values in v you can still use split -- just split on seq_along(v) instead of v (or if v had names you might want to split along names(v)): split(seq_along(v), ct) and if you only

[R] Understanding eval

2007-12-22 Thread Charilaos Skiadas
After many hours of debugging code, I came to the conclusion that I have a fundamental misunderstanding regarding eval, and hope that someone here can explain to me, why the following code acts as it does: foo - function(expr) { eval(substitute(expr), envir=list(a=5),

[R] vector distribution

2007-12-22 Thread -Halcyon-
Hi everyone, say i have a population (stable) with different amounts of animals in every ageclass (80 of age 1, 60 of age 2, etc) in a vector. Can anybody tell me how i can add gender (male or female) to all ageclasses? I want a 1:1 ratio of males and females within the population (as a

[R] number of count of each unique row

2007-12-22 Thread Louis Martin
Hi, I have a matrix of duplicate rows. How to output a list the unique rows with their count? I have used unique to have the unique rows, but can't produce the occurences of each unique row. Thanks Louis - [[alternative HTML version

Re: [R] Understanding eval

2007-12-22 Thread Charilaos Skiadas
On Dec 22, 2007, at 4:44 PM, Duncan Murdoch wrote: 5) eval then creates the environment where this evaluation will take place. It does that by creating an environment containing the frame a=5, and with enclosing environment the parent frame of foo, which is bar's environment. 6) So,

Re: [R] number of count of each unique row

2007-12-22 Thread G. Jay Kerns
Hi Louis, If I am understanding your question correctly, here is one way: suppose your matrix is M of dimension n x k. D - data.frame(M) # convert to data frame ones - rep(1, n) # a column of 1s Now you can count the number of repeats of each unique row. aggregate( ones, by = as.list(D),

[R] [R-pkgs] new version of trackObjs

2007-12-22 Thread Tony Plate
The trackObjs package stores objects in files on disk so that files are automatically rewritten when objects are changed, and so that objects are accessible but do not occupy memory until they are accessed. Also tracks times when objects are created and modified, and caches some basic

Re: [R] Understanding eval

2007-12-22 Thread Gabor Grothendieck
Duncan has already pointed out that consideration of promises is what is missing in the description but in addition the way lm and other functions in R get around it is to use match.call like this: bar2 - function(er) { mc - match.call() mc[[1]] - as.name(foo)

Re: [R] Understanding eval

2007-12-22 Thread Charilaos Skiadas
That's a very good idea. I'll have to see if and how it applies to the more general case I'm dealing with. ( Essentially I am trying to create tkcbind and tkrbind kind of functions, that group together tcltk widgets under a new frame they create, and the frame has to be created before the