An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130219/fdc8fea8/attachment.pl>
make a list with names with s/lapply
2 messages · Hermann Norpois, Rui Barradas
Hello, I'm not sure I understabd, but if the names are in 'namen' then the following might do what you want. names(open.list) <- namen Hope this helps, Rui Barradas Em 19-02-2013 18:09, Hermann Norpois escreveu:
Hello,
I open some files in a directory and get a list.
open.list <- sapply (namen, function (x) {file <- list.files (ddir,
pattern=x, full.names=TRUE) # namen is vector and each element detects a
special file to open
file <- read.table (file)
}
)
This list has no names. I would like to get a list with key/value pairs and
namen is the vector delivering the names. So how does sapply or lapply get
the information to generate key/value pairs?
Thanks
Hermann
[[alternative HTML version deleted]]
______________________________________________ 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.