Skip to content

Have any way to write a funtion into a list ?

3 messages · Nash, Philipp Pagel, Uwe Ligges

#
Have any way to write a funtion into a list ?

--
Nash - morrison at ibms.sinica.edu.tw
#
On Wed, Feb 25, 2009 at 11:11:51PM +0800, Nash wrote:
You can do that the same way you would use with any other object:
[1] 144
[[1]]
function(x){x^2}

[[2]]
[1] 12

[[3]]
[1] "as"


cu
	Philipp
#
Nash wrote:
Sure:

A <- list(mean, var)
A[[1]](1:2) # 1.5
A[[2]](1:2) # 0.5

Uwe Ligges