## Preparing fake matrix
center = cbind(1:6, 1:6)
nesting = rep(1:3, each = 2)
fakeVar1 = rnorm(300, 0, 1)
fakeVar2 = rnorm(300, 0, 1)
fakematrix = data.frame(nesting, center, fakeVar1, fakeVar2)
fakematrix
## Preparing a user-defined function for producing the desired plots
myfun = function(input){
plot(input[, 4], input[, 5], xlab='Xlab label', ylab='Ylab label', type = 'n', bty = 'n')
points(input[, 4], input[, 5], col='red', pch = 16, cex = 2)
}
## Producing KML - the easy way
Plots2GE(data = fakematrix,
center = fakematrix[, 2:3],
nesting = fakematrix[, 1],
customfun = myfun,
goo = "Plots2GE_V1.kml",
testrun = FALSE)
Run the code above in your browser using DataLab