Skip to content

lines()

2 messages · wdmc2012, Duncan Murdoch

#
On 23/11/2012 11:56 AM, wdmc2012 wrote:
The expression

x=geo[(i-1),2]:geo[i,2]

probably isn't what you intended.  It is the sequence of values from 
geo[(i-1),2] to geo[i,2], taking integer steps.  E.g. 1.2:1.8
just gives the single value 1.2; 1.2:3.4 gives the sequence 1.2, 2.2, 3.2.

I would guess you wanted

x=c(geo[(i-1),2], geo[i,2])

instead; it's the pair of points.

I think there's another error here too; you let i range over the rows of a subset of geo, but then plot values from the original matrix/dataframe.

Duncan Murdoch