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
943 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,694 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,842 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
1,122 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
1,129 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
936 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,944 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
674 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
5,584 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
2,061 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,697 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