Hi EverybodyI am trying to make an object with length(a) * length(b) element
using a double loop. But I am getting the last part only. A simple script is
a - c(A-AA, B-BB, C-CC)
b - seq(1, 5)
pre - NULL
post - NULL
page - NULLfor(j in 1:length(a)) {
for(i in 1:length(b)){
pre[j]
Hi Peter,
page is indexed by [i], so for each iteration of j you're rewriting
previous results.
You can fix that very simply, with:
a - c(A-AA, B-BB, C-CC)
b- seq(1, 5)
pre - NULL
post - NULL
page - NULL
pageno - 1
for(j in 1:length(a)) {
for(i in 1:length(b)){
pre[j] -
On Jun 30, 2015, at 6:04 AM, Peter Maclean via R-help wrote:
Hi EverybodyI am trying to make an object with length(a) * length(b)
element using a double loop. But I am getting the last part only. A simple
script is
a - c(A-AA, B-BB, C-CC)
b- seq(1, 5)
pre - NULL
post - NULL
page
3 matches
Mail list logo