[R] Multiply list objects

mdvaan mathijsdevaan at gmail.com
Thu Jun 16 23:49:01 CEST 2011


I am still thinking about this problem. The solution could look something
like this (it's net yet working):

k<-lapply(h, function (x) x*0) # I keep the same format as h, but set all
values to 0
years<-c(1997:1999) # I define the years
for (t in 1:length(years))
	{
	year = as.character(years[t])
	ids = rownames(h[year][[1]])
	}
	for (m in 1:length(relevant_firms))
		{
		k[year][[m]]<-lapply(k[year], function (col) k[year][[1]][,m] =
h[year][[1]][,m] & k[year][[1]][m,] = h[year][[1]][m,])
		} # I am creating new list objects that should look like this
k$'1999'$'8029' and I replace the values in the 8029 column and row by the
original ones in h

Any takes on this problem? Thank you very much!

Best


--
View this message in context: http://r.789695.n4.nabble.com/Multiply-list-objects-tp3595719p3603871.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list