Learn R Programming

berryFunctions (version 1.15.0)

popleaf: create leaflet popup box info

Description

combine data.frame columns into a leaflet popup-box compatible format

Usage

popleaf(df, sel = colnames(df))

Arguments

df
Data.frame
sel
Columns to be selected (Names or index or TRUE/FALSE vector). DEFAULT: colnames(df)

Value

Vector with character strings

See Also

paste

Examples

Run this code
dat <- data.frame(a=14:16, b=letters[14:16], c=LETTERS[14:16], 
                 lat=c(52.58,53.45,52.4), lon=c(6.34,7.23,13.05))
popleaf(dat)
dat$display <- popleaf(dat, 1:4)

## Not run: ------------------------------------
#  # Excluded from CRAN checks
# library(leaflet)
# leaflet(dat) %>% addTiles() %>% addCircleMarkers(~lon, ~lat, popup=~display)
## ---------------------------------------------

Run the code above in your browser using DataLab