I have list of 50 lists of pairs of SpatialLinesDataFrames. That means I have something like:
[[1]] [,1] [,2] [,3] [1,] spldf1 spldf3 spldf5 [2,] spldf2 spldf4 spldf6 [[2]] [,1] [,2] [,3] [1,] spldf1 spldf3 spldf5 [2,] spldf2 spldf4 spldf6 ...[[50]] [,1] [,2] [,3] [1,] spldf1 spldf3 spldf5 [2,] spldf2 spldf4 spldf6 I want a list of 50 elements of pairs with the length of every pair. I did:
for(i in 1:50){ for(j in 1:3){ lengthpair[]=sum(length(pairs[][[1,j]]),length(pairs[][[2,j]])) } }lengthpair is a list to store the sum of length of pairs every time.pairs is the list with the pairs of SpatialLineDataFrames.
From this all I get is the sum of the length of last pair, of last run of my loop. What can I change to my code to do it?
أكثر...
[[1]] [,1] [,2] [,3] [1,] spldf1 spldf3 spldf5 [2,] spldf2 spldf4 spldf6 [[2]] [,1] [,2] [,3] [1,] spldf1 spldf3 spldf5 [2,] spldf2 spldf4 spldf6 ...[[50]] [,1] [,2] [,3] [1,] spldf1 spldf3 spldf5 [2,] spldf2 spldf4 spldf6 I want a list of 50 elements of pairs with the length of every pair. I did:
for(i in 1:50){ for(j in 1:3){ lengthpair[]=sum(length(pairs[][[1,j]]),length(pairs[][[2,j]])) } }lengthpair is a list to store the sum of length of pairs every time.pairs is the list with the pairs of SpatialLineDataFrames.
From this all I get is the sum of the length of last pair, of last run of my loop. What can I change to my code to do it?
أكثر...