RE: [R] Indexing Lists and Partial Matching

2005-01-27 Thread McGehee, Robert
tat.math.ethz.ch Subject: RE: [R] Indexing Lists and Partial Matching This came up a few months ago. Check the thread on hashing and partial matching around Nov 18. The short answer is no, you can't turn it off because lots of code relies on that behavior. Reid Huntsinger -Original Me

RE: [R] Indexing Lists and Partial Matching

2005-01-27 Thread Huntsinger, Reid
lf Of McGehee, Robert Sent: Thursday, January 27, 2005 9:34 AM To: r-help@stat.math.ethz.ch Subject: [R] Indexing Lists and Partial Matching I was unaware until recently that partial matching was used to index data frames and lists. This is now causing a great deal of problems in my code as I some

RE: [R] Indexing Lists and Partial Matching

2005-01-27 Thread Liaw, Andy
This has been discussed a few times on this list before, so you might want to dig into the archive... You might want to check existence of name instead of checking whether the component is NULL: > x <- list(bc="bc", ab="ab") > is.null(x$b) [1] FALSE > "b" %in% names(x) [1] FALSE Andy > From: M

[R] Indexing Lists and Partial Matching

2005-01-27 Thread McGehee, Robert
I was unaware until recently that partial matching was used to index data frames and lists. This is now causing a great deal of problems in my code as I sometimes index a list without knowing what elements it contains, expecting a NULL if the column does not exist. However, if partial matching is u

R: [R] Indexing lists

2004-09-16 Thread Vito Muggeo
-- Original Message - From: Perez Martin, Agustin <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 16, 2004 1:33 PM Subject: [R] Indexing lists > DeaR useRs: > > I have a list with 500 elements, in each other there are data.frames and I > want to take

Re: [R] Indexing lists

2004-09-16 Thread Adaikalavan Ramasamy
m <- matrix(1:9, nc=3) a <- list(m, m+10, m+100, m+1000) sapply(a, function(mat) mat[1,1]) [1]1 11 101 1001 On Thu, 2004-09-16 at 12:33, Perez Martin, Agustin wrote: > DeaR useRs: > > I have a list with 500 elements, in each other there are data.frames and I > want to take the first row

Re: [R] Indexing lists

2004-09-16 Thread Gabor Grothendieck
Perez Martin, Agustin umh.es> writes: : I have a list with 500 elements, in each other there are data.frames and I : want to take the first row and the first column of each elements of my list : since the first to the 500-th. Here are some variations depending on what you want. Also try all t

Re: [R] Indexing lists

2004-09-16 Thread Sean Davis
On Sep 16, 2004, at 7:57 AM, Peter Dalgaard wrote: Sean Davis <[EMAIL PROTECTED]> writes: Maybe not the best solution, but something like: lapply(mylist,function(x) {return(list(FirstCol=mylist[,1],FirstRow=mylist[1,]))}) ITYM list(FirstCol=x[,1],FirstRow=x[1,]) Uh, Duh! Thanks. Some help I am...

Re: [R] Indexing lists

2004-09-16 Thread Peter Dalgaard
Sean Davis <[EMAIL PROTECTED]> writes: > Maybe not the best solution, but something like: > > lapply(mylist,function(x) > {return(list(FirstCol=mylist[,1],FirstRow=mylist[1,]))}) ITYM list(FirstCol=x[,1],FirstRow=x[1,]) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ ---

Re: [R] Indexing lists

2004-09-16 Thread Peter Dalgaard
"Perez Martin, Agustin" <[EMAIL PROTECTED]> writes: > DeaR useRs: > > I have a list with 500 elements, in each other there are data.frames and I > want to take the first row and the first column of each elements of my list > since the first to the 500-th. > > Thanks and excuse my bad English.

Re: [R] Indexing lists

2004-09-16 Thread Sean Davis
Maybe not the best solution, but something like: lapply(mylist,function(x) {return(list(FirstCol=mylist[,1],FirstRow=mylist[1,]))}) In any case, look at ?lapply Sean On Sep 16, 2004, at 7:33 AM, Perez Martin, Agustin wrote: DeaR useRs: I have a list with 500 elements, in each other there are data

[R] Indexing lists

2004-09-16 Thread Perez Martin, Agustin
DeaR useRs: I have a list with 500 elements, in each other there are data.frames and I want to take the first row and the first column of each elements of my list since the first to the 500-th. Thanks and excuse my bad English. --- [[alternative HTML version deleted]] __