title: How to rotate symbols (representing spatial point data) based on feature with tmap and sf?
body: <p>I want to represent 2 ships on a map in an interactive way (leaflet based method) with some of their metadata as well. Naturally, metadata of a ship usually contains the heading of the vessel and the most digestible way to represent is by rotating the symbol of the point data accordingly. </p>
  
  <p>After some first trials, I managed to recreate it by following  <a href="https://stackoverflow.com/questions/34020079/icon-rotation-in-leaflet-package">icon rotation in leaflet package</a>, using sheer leaflet and a plugin that allowed me to write in smooth syntax like <code>rotationAngle=~T_heading</code>. This way's result looks like below.<a href="https://i.stack.imgur.com/hmab3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hmab3.png" alt="enter image description here"></a></p>
  
  <p>However, I am searching for a way to use sf and tmap packages as syntax (tmap's interactive view is also leaflet based) since they are much more complete and sophisticated frameworks for managing and visualizing geospatial information. </p>
  
  <p>Let's again recreate the sample data of the two vessels and plot them. </p>
  
  <pre><code>aship&lt;-c(23.622333,37.937489,'Santa Maria',8,300)
  bship&lt;-c(23.621303,37.937430,'Vancouver CC',10,35)
  shipdata&lt;-data.frame(rbind(aship,bship))
  colnames(shipdata)&lt;-c('long','lat','VesselName','sog','T_heading')
  shipdata$long&lt;-as.numeric(as.character(shipdata$long))
  shipdata$lat&lt;-as.numeric(as.character(shipdata$lat))
  shipdata$sog&lt;-as.numeric(as.character(shipdata$sog))
  shipdata$T_heading&lt;-as.numeric(as.character(shipdata$T_heading))
  #Simple features transformation 
  ship_sf&lt;-shipdata%&gt;%
  st_as_sf(coords=c('long','lat'))%&gt;%
  st_set_crs(4326)
  # Use tmap and plot the vessels using a vessel_icon of my own
  map_s1&lt;-tm_basemap(leaflet::providers$OpenStreetMap)+
  tm_shape(ship_sf)+
  tm_markers(shape = vessel_icon)+
  tm_view(set.view=c(lon=23.622333,lat=37.937489,zoom=17))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6ErQW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6ErQW.png" alt="enter image description here"></a></p>
  
  <p>Up until now I haven't found a way to rotate markers in a tmap way. Is there any simple solution i am missing out?</p>
  
  <p>Much appreciated</p>