Rohit-
If I understand you correctly, and your list's name is mylist,
then
mapply('*',mylist,as.numeric(names(mylist)))
will do what you want. In the future, please provide a reproducible
example.
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spec...@stat.berkeley.edu
On Mon, 21 Feb 2011, Rohit Pandey wrote:
Hi R community,
I have a question I'm sure is very simple for most of you.
I have a list, with each element being a matrix and the names of the
elements are numbers (like 1,3,...). I can extract the matrices and the
names individually. Now, I want to multiply each of the names to the
individual list matrices (after converting to numbers of course).
I could use a for loop, but the very reason I have this list is that I was
trying to avoid loops (using lapply). So, turning to one now could defeat
the whole purpose.
Thanks in advance,
--
Thanks,
Rohit
Mob: 91 9819926213
[[alternative HTML version deleted]]
______________________________________________
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.
______________________________________________
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.