Dear Mahbub
Thanks a lot for the help.


----- Original Message ----
From: Mahbub Latif <[EMAIL PROTECTED]>
To: Muhammad Azam <[EMAIL PROTECTED]>
Sent: Wednesday, October 15, 2008 12:30:13 PM
Subject: Re: [R] request: How can we ignore a component of list having no 
element


try this,

junk <- sapply(x,function(i) !is.null(i))
y <- x[junk]



On Wed, Oct 15, 2008 at 11:23 AM, Muhammad Azam <[EMAIL PROTECTED]> wrote:

Dear friends
There is a list of arrays comprising different no of rows and columns even 
sometimes NULL, such as [[2]] given below. How can we ignore [[2]] or others 
like this in the complete list. Any help in this regard is needed. Thanks

[[1]]
      [,1] [,2]
[1,]    3    1
[2,]    3    1
[3,]    3    1

[[2]]
NULL

[[3]]
       [,1] [,2] [,3] [,4] [,5] [,6] [,7]
 [1,]    3    1    0    0    0    0    0
 [2,]    3    1    0    0    0    0    0
 [3,]    3    1    0    0    0    0    0
 [4,]    3    1    3    1    3    2    1
 [5,]    3    1    3    1    3    2    1
 [6,]    3    1    3    1    3    2    0

[[4]]
      [,1] [,2] [,3] [,4]
[1,]    3    0    0    0
[2,]    3    1    3    3
[3,]    3    1    3    3
[4,]    3    1    3    0

OR
x1=c(1,2,3); x2=c(1,2,3,4,6); x3=c(); x=list(x1,x2,x3)

M.Azam



       [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



-- 
A.H.M. Mahbub Latif
Assistant Professor
Applied Statistics
Institute of Statistical Research and Training
University of Dhaka, Dhaka 1000, Bangladesh
web : http://www.isrt.ac.bd/mlatif



      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to