search for: createvarmean

Displaying 1 result from an estimated 1 matches for "createvarmean".

2008 Oct 22
1
getting the "name" of an object
...More precisely, with a simple example : I have a named list of objects : myList = list(a=rnorm(10),b=rnorm(10),c=rnorm(10)) I would like to create a new object from each of the components of myList using the "sapply" function, for example to get the mean of all components of myList : createVarMean = function(obj){ obj.name = ****** obj.mean = mean(obj) assign(obj.name,obj.mean) }#end of createVarMean Using : sapply(myList,createVarMean) Should then create all the objects. Any idea to get the names ? Perhaps using object oriented programming (is there an equivalent of...