# Maptools library required
library(maptools)
# load line object
rivers <- readShapeSpatial(system.file("shapes/fylk-val-ll.shp",
package="maptools")[1], proj4string=CRS("+proj=longlat"))
# create kml file
kmlLines(rivers, kmlfile = "rivers.kml", name = "R Lines",
description = "Hello!", col = "blue", visibility = 1, lwd = 1,
kmlname = "", kmldescription = "")
Run the code above in your browser using DataCamp Workspace