Hi, I have a vector and a list, with data I would like to multiply together.
So for instance I have a vector s: [[1]] [1] 44308 [[2]] [1] 4371 Also, I have a list d: [[1]] [1] 1201 6170 2036 2927 1625 1391 2074 1453 3172 3027 4691 3719 1185 320 2071 1027 1046 1186 1403 580 1382 440 8 174 [[2]] [1] 6521 688 2678 3409 3033 1608 3618 1461 1836 2104 879 1095 2630 1591 2986 703 2548 913 1426 753 256 869 106 I want to multiply them together and put the results in a matrix. This is my syntax: for(i in 1:length(s)) for(j in 1:length(d)) m<-d[[j]][j]/s[[i]] #m is the matrix of dimensions set to X(e.g. 10X10) However, it seems I only get one result when i get m, which is the last value of d/j, which is m[1]=0.04 in this case. I am sure Im doing something wrong here, but can't quite find the solution. Thanks. Mark ______________________________________________ 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.