Hi there,

I have a very simple question. If I execute the following code:


test <- function(x) {
        name <- paste(x,"info_within_function")
        c(1,2,3,4,5)
}

ret <- lapply(1:10, test)


, I end up with a list and each entry is just numbered [[1]], [[2]], ... [[10]]

How can I force the result entries gettings names which are determined within the function. For this example, I'd like the entries named like:

"1 info_within_function" instead of [[1]]
"2 info_within_function" instead of [[2]]
and so on.
(that's why I put this strange "name <- ..." line inside)

Can anybody help me what I have to do to get the returned list entries like 
this?

Thanks a lot!

Antje

______________________________________________
R-help@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.

Reply via email to