[R] Have any way to write a funtion into a list ?

Philipp Pagel p.pagel at wzw.tum.de
Wed Feb 25 16:28:27 CET 2009


On Wed, Feb 25, 2009 at 11:11:51PM +0800, Nash wrote:
> Have any way to write a funtion into a list ?

You can do that the same way you would use with any other object:

> foo <- function(x){x^2}
> foo(12)
[1] 144
> a <- list(foo, 12, 'as')
> a
[[1]]
function(x){x^2}

[[2]]
[1] 12

[[3]]
[1] "as"


cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel




More information about the R-help mailing list