Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From <a href="http://r.789695.n4.nabble.com/Calculating-distance-between-longitude-latitude-of-2-points-td3050123.html" rel="nofollow noreferrer">here</a> I found some packages to calculate distance between coordinates. Assuming your data is called <code>dtf</code> and using the <code>RSEIS</code> package: </p> <pre><code>dtf &lt;- data.frame(rbind(c(-85.01478,37.99030,-68.3167), c(-85.00752,37.97601,-68.0247),c(-85.00027,37.96172,-67.9565), c(-84.99302,37.94743,-67.8917))) names(dtf) &lt;- c('lon','lat','int') library(RSEIS) travelint &lt;- function(i,data){ ddeg &lt;- GreatDist(dtf$lon[i],dtf$lat[i],dtf$lon[i+1],dtf$lat[i+1])$ddeg; dint &lt;- dtf$int[i+1] - dtf$int[i]; return(list(ddeg,dint))} out &lt;- sapply(1:(nrow(dtf)-1),data=dtf,travelint) out &lt;- data.frame(matrix(as.numeric(out),ncol=2,byrow=T)) out$X1 &lt;- cumsum(out$X1) </code></pre> <p>This will take your data, calculate the distance traveled between points and the intensity change between them. After that it can be plotted like this:</p> <pre><code>ggplot(out,aes(X1,X2)) + geom_line() + labs(x="Distance (Degrees)",y="Intensity Change") </code></pre> <p><img src="https://i.stack.imgur.com/kHaou.png" alt="enter image description here"></p> <p>If instead you want increasing intensity , you can use <code>cumsum</code> again to get the cumulative change in intensity and then add it to the first intensity:</p> <pre><code>out2 &lt;- out out2 &lt;- rbind(c(0,0),out2) out2$X2 &lt;- cumsum(out2$X2) + dtf$int[1] ggplot(out2,aes(X1,X2)) + geom_line() + labs(x="Distance (Degrees)",y="Intensity") </code></pre> <p><img src="https://i.stack.imgur.com/fzCSN.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload