search for: alister

Displaying 20 results from an estimated 169 matches for "alister".

Did you mean: lister
2004 Jan 15
3
Extracting multiple elements from a list
For a long time I've wanted a way to conveniently extract multiple elements from a list, which [[ doesn't allow. Can anyone suggest an efficient function to do this? Wouldn't it be a sensible addition to R? For example, alist <- list() alist[[1]] <- list() alist[[1]]$name <- "first" alist[[1]]$vec <- 1:4 alist[[2]] <- list() alist[[2]]$name <-
2006 Nov 06
5
alist()
In trying to get NULL members into a list, I found out about alist(). x<-alist() x$one<-1 x$two<-NULL but x$two doesn't exist. It seems, though, that an alist is just a list. How can one put NULL members into a list?
2009 Nov 19
4
Is there an variant of apply() that does not return anything?
There are a few version of apply() (e.g., lapply(), sapply()). I'm wondering if there is one that does not return anything but just silently apply a function to the list argument. For example, the plot function is applied to each element in 'alist'. It is redundant to return anything from apply. apply(alist,function(x){ plot each element of alist})
2008 Oct 01
2
Bug or feature with finding a list element?
This seems odd. When I try to look up a list element which has a space in the name using just the first word (i.e. no spaces), it will sometimes return the element with a space in the name and sometimes it will return NULL. Try this: alist <- list( 'hello'=10, bye=20, 'hello world'=30, 'goodbye world'=40, 'hi world'=50, 'goodbye foo'=60, 'goodbye
2003 Nov 13
1
Can't get Sweave syntax highlighting with Emacs
I can't get Emacs to automatically do syntax highlighting of Sweave files. I have followed Friedrich's suggestion for code to insert into my .emacs file. The complete section from my .emacs file is given below. When I load a *.Snw file, font is white until I press M-x, then the first code and document chunks get highlighted, but not the rest of the file. Latex and Noweb menus are
2013 Mar 28
2
how to search a list that contains multiple dissimilar vectors?
Dear All, This is a simple question, but I'm stumped about the simplest way to search a list object such as the following: This randomish snippet: n <- c(round(runif(round(runif(1,1,10),0),1,10),0)) alist <- new("list") for (i in seq_along(n)) { alist[[i]] <- c(round(runif(round(runif(1,1,10),0),1,10),0)) } names(alist) <- sample(letters[1:length(n)]) rm(n);c(alist)
2009 Dec 30
1
What am I doing wrong in my loops?
Dear kind list people: I have the following code: >hours [1] "0" "1" "2" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" "19" "20" "21" "22"
2006 May 27
0
Correction to ?alist (PR#8904)
Hi, people. ?alist says: 'alist' is like 'list', except in the handling of tagged arguments with no value. As written, this description is misleading. For example: > list(e=3+5) $e [1] 8 > alist(e=3+5) $e 3 + 5 We are not in the situation of tagged arguments with no value, and then, clearly, 'list' and 'alist' behave
2003 Aug 20
0
end-of-loop-timeout problem and submit-bug-report output (resending) (PR#3841)
(Hi, I tried sending this to ess-bugs, but got it bounced back: "user unknown". Hope this isn't too off-topic for ess-help. Scot) I'm using Xemacs 21.4, ess 5.1.24, on Windows 98 SE, with John Fox's configuration files: (http://socserv.mcmaster.ca/jfox/Books/Companion/ESS/index.html) and am getting the end-of-loop-timeout warning message I've seen reported to
2006 Jan 04
17
Scriptaculous + Prototype shrunk to < 50Kb
Maybe I''m anal but I like fat-free JS, so I pulled the Proptotype and core Scriptaculous files into one single JS file at 49Kb. It''s "packed" so if you care about that kind of thing, it''s also "obfuscated". Download from my personal site at www.alistercameron.com. - Alister PS. Of course this is the current version as posted on the Scriptaculous site. Alister Cameron Managing Director <http://www.cameroncreative.com/images/cc_logo_small.gif> <http://www.cameroncreative.com/> Cameron Creative PO Box 4321 <http://map...
2018 Jun 08
3
Subsetting the "ROW"s of an object
> On Jun 8, 2018, at 1:49 PM, Hadley Wickham <h.wickham at gmail.com> wrote: > > Hmmm, yes, there must be some special case in the C code to avoid > recycling a length-1 logical vector: Here is a version that (I think) handles Herve's issue of arrays having one or more 0 dimensions. subset_ROW <- function(x,i) { dims <- dim(x) index_list <-
2009 Oct 01
1
inverse currying
Dear list, I have the following function, sugar = function(fun, id = "id"){ ff <- formals(fun) if( id %in% names(ff)) stop("id is part of args(fun)") formals(fun) <- c(unlist(ff), alist(id=)) fun } which one may use on a function foo, foo = function(x){ x } sugar(foo) # results in the extended closure, function (x, id) { x } Its limitation (other
2001 Oct 16
4
Assignment of structures on a given environment
Hi, In order to avoid deep copies by passing large arguments to functions or returning values, I'm trying to do the assignment of variables in a given environment. The problem is when I try to assign a structure: a list for example. If I have: ind <- c("a","b") my idea is doing something like l <- alist() l[ind] <- as.list(c(20,40)) in a given
2006 Mar 14
3
rails on emacs - need a working .emacs sample
I would like to hear from some one who has ecb, multiple modes with ruby mode + html mode, rails mode all working together and playing well. I had ecb working with Ruby syntax highlighting. That was a no-brainer since I just had to apt-get them on my Debian Sarge box. It got a bit more comlex after I got most of the .el files in the articles http://www.emacswiki.org/cgi-bin/emacs/RubyOnRails
2004 Jan 09
1
Call and memory
I use a large real matrix, X, in C code that is passed from R and transposed in place in the C code. I would like to conserve memory and, if possible, allocate space for only one copy of X -- hence I would like to pass a pointer to the data in the X object to the C code. The Writing R Extensions manual says that neither .Call nor .External copy their arguments. They also say that these
1999 Mar 29
3
problems with formals and get (PR#151)
With 0.63.3, try test <- function(){ fn <- function(a) print("hello") print(is.function(fn)) print(names(formals("fn")))} test() if fn is not quoted in the last line of test, it works properly. test <- function(){ fn <- function() print("hello") formals(fn) <- alist(a=,b=) return(fn)} formals(test()) now try with line 3 of test changed to
2005 Feb 28
2
Changing function arguments to NULL
I'm trying to build a recursive set of functions that take a set of arguments, change some of the arguments and recursively call the same (or different) function. For example here's a stupid recursive counting function that prints back all integers from x to 0 (and ignores arguments y and z) cnt <- function(x, y, z) { stopifnot(is.numeric(x)) print (x) recursionFUN <-
2009 Mar 22
2
Following progress in a lapply() function
Dear all, I am processing a very long and complicated list using lapply through a custom function and I would like to generate some sort of progress report. For instance, print a dot on the screen every time 1000 item have been process. Or even better, reporting the percent of the list that have been process every 10%. However, I can't seem to figure out a way to achieve that. For instance,
2007 Oct 16
2
How to speed up multiple for loop over list of data frames
Hi there, I have a multiple for loop over a list of data frames for ( i in 1:(N-1) ) { for ( j in (i+1):N ) { for ( p in 1:M ) { v_i[p] = alist[[p]][i,"v"] v_j[p] = alist[[p]][j,"v"] } rho_s = cor(v_i, v_j, method = "spearman") rho_p = cor(v_i, v_j, method = "pearson"
2003 Oct 04
0
allocating memory in a C module (fwd)
I pressed ^X in the wrong window. Here's the right code: Here's some code that does a pointless example In C: #include "Rinternals.h" /* function takes no arguments and returns an object */ SEXP pie(){ int n; SEXP alist, avector; /* work out how long a list to return */ n = 2; /* create the list */ PROTECT(alist = allocVector(VECSXP, n)); /* create the first