I have been onto this all day but haven't found a satisfying solution yet. I plotted a raster and created a matrix (="coord_mat"; left column contains X-coordinates, right column the Y-coordinates) that contains the coordinates of multiple points within that raster. Now i want to connect all those points with a line (without plotting the points too) and plot that line in the raster I already plotted. My code so far is the following:
for(k in 1:nrow(coord_mat))
{
x <- coord_mat[k,1]
y <- coord_mat[k,2]
lines(x,y)
}
I'm pretty much a newbie in R so I will be thankful for any hint. Thanks in advance :)