[R] name returned by lapply

Antje niederlein-rstat at yahoo.de
Fri Jul 18 14:19:21 CEST 2008


Hi Gavin,

thanks a lot for your answer.
Maybe I did not explain very well what I want to do and probably chose a bad 
example. I don't mind spaces or names starting with a number. I could even name it:

"Hugo1", "Hugo2", ...

My biggest problem is, that not only the values are calculated/estimated within 
my function but also the names (Yes, in reality my funtion is more complicated).
Maybe it's easier to explain like this. the parameter x can be a coordinate 
position of mountains on earth. Within the funtion the height of the mountain 
is estimated and it's name.
In the end, I'd like to get a list, where the entry is named like the mountain 
and it contains its height (or other measurements...)


> ## now that we have a list, we change the names to what you want
> names(ret) <- paste(1:10, "info_within_function")

so this would not work, because I don't have the information anymore about the 
naming...

Antje



More information about the R-help mailing list