Re: [R] name returned by lapply

From: Antje <niederlein-rstat_at_yahoo.de>
Date: Fri, 18 Jul 2008 14:19:21 +0200

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



R-help_at_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. Received on Fri 18 Jul 2008 - 12:22:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jul 2008 - 13:31:56 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive