plot map points from a dataframe

0 votes
I created a sample data frame with 3 locations and its longitude and latitude points. I want to add the markers at those points. Can someone help?

My data frame -

     label     long      lat
1  My Office 77.6944 12.98110
2 My College 77.5647 13.0305
3   My House 77.6547 13.0126
Sep 17 in Data Analytics by peter
17 views

1 answer to this question.

0 votes

Hi Peter,

Use below code.

leaflet(df) %>% addTiles() %>% addMarkers(popup = ~label)

or 

m <- leaflet(df) %>% addTiles()
m %>% addMarkers(popup = ~label)
answered Sep 17 by priya

Related Questions In Data Analytics

0 votes
1 answer

How to extract specific columns from a DataFrame ?

Yes there are so many ways: df[,c(V2,V4)] and another ...READ MORE

answered Apr 11, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,248 views
0 votes
1 answer

Removing outliers from a box-plot - ggplot2 - R

You just have to add 'outlier.shape=NA' inside ...READ MORE

answered May 31, 2018 in Data Analytics by Bharani
• 4,550 points
3,794 views
0 votes
1 answer

Store a built in dataset or dataframe from R to database

dbWriteTable() function allows you to store data ...READ MORE

answered Jul 29 in Data Analytics by anonymous
• 31,840 points
22 views
0 votes
1 answer

How to sort substring from a dataframe

First, extract the substring from the data ...READ MORE

answered Nov 4 in Data Analytics by Cherukuri
• 31,840 points
31 views
0 votes
1 answer

How to add external markers in maps?

Use external markers by creating icons using ...READ MORE

answered Oct 14 in Data Analytics by Cherukuri
• 31,840 points
17 views
0 votes
1 answer

How to add legend or any text on the map in leaflet?

See below example, > p = colorFactor(palette = ...READ MORE

answered Oct 28 in Data Analytics by anonymous
• 31,840 points
29 views
0 votes
0 answers

fix the map area using leaflet and use ggplot

I created a map using leaflet and ...READ MORE

Sep 18 in Data Analytics by anonymous
• 31,840 points
15 views
0 votes
1 answer

How to save leaflet object as an image?

Yes, you can save leaflet objects as ...READ MORE

answered Oct 28 in Data Analytics by Cherukuri
• 31,840 points
38 views
0 votes
1 answer

How to add create a box plot with categorical columns?

One way is to convert to factor ...READ MORE

answered Jul 4 in Data Analytics by anonymous
• 31,840 points
51 views
0 votes
1 answer

Export the plot to a pdf or png - R

You need to close the device to ...READ MORE

answered Jul 15 in Data Analytics by anonymous
38 views