dear bro, hear is my markdown code:
---
title: "learning_map2"
author: "huynhbinh"
date: "26/8/2020"
output: html_document
---
# This lesson give a way to build a map with points and labels
## Get necessary packages
``` {r}
library(tidyverse)
library(ggplot2)
library(raster)
```
## Get data from GADM for Vietnam
```{r}
vn<-getData('GADM',country='Vietnam',level=3)
vl<-vn[vn$NAME_1=='Vĩnh Long',] #pick row for "Vinh Long" province
head(vn)
head(vl)
```
## Change data to plot data by function "fortify" in "tidyverse" package
``` {r}
dat_plot<-fortify(vl,region = 'NAME_2') #choose data to district level#
lab<-data.frame(long=105.9622895,lat=10.2365819,pos='MTU') #set point coordinate and its label#
khuvuc<-aggregate(cbind(long,lat)~id,data=dat_plot,FUN=mean) #create label for each district#
head(dat_plot)
lab
khuvuc
```
the error appear in the line
dat_plot<-fortify(vl,region = 'NAME_2') #choose data to district level#
but everything was ok when I ran it on my Mac, haha. I published it on Rpub, can may I paste the Rpub link at here, so you can see all my code easily?
Dear Mr. @andresrcs , thank for your advice! I'm reading it.