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, 2019 in Data Analytics by peter
727 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, 2019 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
8,367 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,660 points
24,460 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 30, 2019 in Data Analytics by anonymous
• 33,030 points
805 views
0 votes
1 answer

How to sort substring from a dataframe

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

answered Nov 4, 2019 in Data Analytics by Cherukuri
• 33,030 points
900 views
0 votes
1 answer

How to add external markers in maps?

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

answered Oct 14, 2019 in Data Analytics by Cherukuri
• 33,030 points
647 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, 2019 in Data Analytics by anonymous
• 33,030 points
8,418 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, 2019 in Data Analytics by anonymous
• 33,030 points
485 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, 2019 in Data Analytics by Cherukuri
• 33,030 points
4,917 views
+1 vote
1 answer

How to add create a box plot with categorical columns?

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

answered Jul 4, 2019 in Data Analytics by anonymous
• 33,030 points
1,753 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, 2019 in Data Analytics by anonymous
2,519 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP