I have a dataframe in R which contains numerous columns of lat long coordinates. Each row of the data frame contains 9 x lat/long coor points.

I wish to plot each of these rows in Google Earth using the plotKML function or any other R package for that matter since I can only use R V2.14.0!!

Ideally I would like to continue using v3.x.x but plotKML doesn't work then so if there's an alternative R->KML package please shout.

I've read up about the differences between polygon and polygons here but I am having difficulty converting my dataframe to a spatialpolygon in order to plot the data in Google Earth. I suspect it's because I have multiple columns of lat long coordinates and plotKML doesn't know (or I haven't specified correctly) what to do with them.

Can anyone point me in the right direction about how to go about this?

I have a sample of my data here in dput() format if it's of any benefit.

  • I used yesterday plotKML in R 3.3.2. Why do you say that? – aldo_tapia Nov 29 '16 at 18:12
  • Because it says it here on their project page link. Every time I tried on 3.3 I got an error when installing the package. Have I missed something here? – TheGoat Nov 29 '16 at 18:29
  • works only on >= R 2.14, so it works in R version same or higher than 2.14. Can you paste error message? Even more, plotKML installed in my computer says Built: R 3.3.0; ; 2016-05-05 18:54:12 UTC; unix for Package: plotKML Version: 0.5-6 Date: 2016-05-02 – aldo_tapia Nov 29 '16 at 18:34
  • > library(plotKML) Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called ‘chron’ In addition: Warning message: package ‘plotKML’ was built under R version 3.3.2 Error: package or namespace load failed for ‘plotKML’ – TheGoat Nov 29 '16 at 18:35
  • > sessionInfo() R version 3.3.1 (2016-06-21) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) – TheGoat Nov 29 '16 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.