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
14 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,113 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,420 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
• 28,040 points
20 views
0 votes
0 answers

How to sort substring from a dataframe

How to sort substring from a dataframe? ...READ MORE

Aug 4 in Data Analytics by anonymous
26 views
0 votes
1 answer

How to add external markers in maps?

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

answered 5 days ago in Data Analytics by Cherukuri
• 28,040 points
15 views
0 votes
0 answers

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

I'm new to leaflet and working on ...READ MORE

Sep 18 in Data Analytics by anonymous
• 28,040 points
19 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
• 28,040 points
9 views
0 votes
0 answers

How to save leaflet object as an image?

How to save leaflet object as an ...READ MORE

Sep 19 in Data Analytics by anonymous
• 28,040 points
17 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
• 28,040 points
44 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
28 views