search for: napply

Displaying 8 results from an estimated 8 matches for "napply".

Did you mean: apply
2007 Nov 25
2
accessing the "address" of items in a recursive list
Dear useRs, I am working on a project involving the clustering of a large dataset. I need to extract specific sub-clusters from the parent dendrogram for further analysis. The data is too large for the use of convenient tools such as identify.clust (it selects the specific group of interest on a graph), so alternatively I have saved the plot as a large image file so that it can be printed or
2010 Sep 24
4
Object Browser
What's the best object browser? Dear all, I have tried all the popular R IDE or editors like Eclipse, Komodo, JGR, Revolution... They all have fancy fucntions like auto completion, syntax highlight.... BUT, I JUST WANT A OBJECT BROWSER! The easiest way to view objects in R console is fix(), but you have no global view of all the objects in the workspace. Revolution has the best object
2003 Jan 19
1
Re: check variables: a Q from a beginner
...bit faster, shorter, and adds memory usage information. It combines an object's mode and class information into a "Type" column that seems more parsimonious, and adds an argument for specifying a sort column. -- Dave Hinds ls.obj <- function (pos = 1, pattern, order.by) { napply <- function(names, fn) sapply(names, function(x) fn(get(x, pos = pos))) names <- ls(pos = pos, pattern = pattern) obj.class <- napply(names, function(x) as.character(class(x))[1]) obj.mode <- napply(names, mode) obj.type <- ifelse(is.na(obj.class),obj.mode,obj...
2012 Feb 20
3
Confused: Inconsistent result?
This is copy & paste from my session: > xyz<-as.vector(c(ls(),as.matrix(lapply(ls(),class)))) > dim(xyz)<-c(length(xyz)/2,2) > > allobj<-function(){ + xyz<-as.vector(c(ls(),as.matrix(lapply(ls(),class)))); + dim(xyz)<-c(length(xyz)/2,2); + return(xyz) + } > xyz       [,1]              [,2]        [1,] "a"               "character"  [2,]
2012 Oct 24
0
recursive function on a structured list of lists (dendrogram)
...is made within the function saving both elements at the leaf and branch levels. For reference the dendrapply function is as follows: function (X, FUN, ...) { FUN <- match.fun(FUN) if (!inherits(X, "dendrogram")) stop("'X' is not a dendrogram") Napply <- function(d) { r <- FUN(d, ...) if (!is.leaf(d)) { if (!is.list(r)) r <- as.list(r) if (length(r) < (n <- length(d))) r[seq_len(n)] <- vector("list", n) r[] <- lapply(d, Napply)...
2002 Apr 10
3
problem with do.call
Hi I'm writing a function that uses four parameters (scalars) and I need to run it in an iterative process (the parameters vary to find the minimum RSS). I don't want to use loops and so tried the do.call function. However it didn't work. My understanding is that the do.call simple runs the function replacing the arguments (scalars by vectors), instead of runing the function for
2002 Apr 17
4
union of lists
Hi there, Given 2 lists of integer vectors, i.e.: > lista1 $"1" [1] 1 34 5 $"2" [1] 2 1 $"3" [1] 3 10 15 > lista2 $"1" [1] 1 5 $"2" [1] 2 1 $"3" [1] 3 10 29 I want to obtain the union of both, defined as the union of the vectors, that is lista.union[[1]] <- union(lista1[[1]],lista2[[1]]): > lista.union
2000 Aug 21
2
Loop removal possible?
Dear all, may be somebody have ideas to my following problem: I have to multiplicate each element of a vector with his position in the sorted vector. This isn't a problem ;-) But now i have a weighting vector with the weight of each observation, and my problem starts. A little example (due to my bad english) maybe helps to understand: x<-c(10,40,50,100) # income vector for instance