leafletLabel: Neatly format leaflet tooltips

Description Usage Arguments

View source: R/advanced_R_studies.R

Description

Takes in a dataframe, and returns the same dataframe with a label column formatted for leaflet maps.
Example:

leaf <- leafletLabel(routes, c("Type", "Name"), c("type", "name"), titleCol = "origin")
leaf <- leaflet(leaf)
leaf <- addMarkers(leaf, lng = ~long, lat = ~lat, popup = ~label)

Usage

1
leafletLabel(df,textNames,colNames,titleCol=NULL,title=NULL,size=2,titleSize=4,digits=2)

Arguments

df

The dataframe you wish to label

textNames

The names of the text fields you want to display. Should correspond to colNames.

colNames

The names of the columns whose text you want to display. Should correspond to textNames.

titleCol

Optional. The name of the column that holds a title for your tooltips.

title

Optional. The name you wish to apply to all your tooltips.

size

Size of regular text, Default 2.

titleSize

Size of title text, Default 4.

digits

Number of digits to round numeric columns to, Default 2.


C-Research/c4aRs documentation built on Sept. 2, 2021, 1:10 p.m.