On 12.07.2014 15:25, ce wrote:


Dear all,

I have a list of arrays :

foo<-list(A = c(1,3), B =c(1, 2), C = c(3, 1))

foo
$A
[1] 1 3

$B
[1] 1 2

$C
[1] 3 1

if( foo$C[1] == 1 ) foo$C[1]

  lapply(foo, function(x) if(x[1] == 1 )  x  )

$A
[1] 1 3

$B
[1] 1 2

$C
NULL

I don't want to list $C NULL  in the output. How I can do that ?

Either use your own print function or, if you do not want NULL elements in the object, remove them.

Best,
Uwe Ligges


______________________________________________
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.


______________________________________________
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