View source: R/make.popup.ej.R
make.popup.ej | R Documentation |
Takes percentiles (unlike make.popup.d or make.popup.e, which need raw values too), and presents those as a text field to be used as the text in a popup window on a map.
make.popup.ej(pctile, prefix = "pctile.text.", basenames)
pctile |
required integers 0 to 100 |
prefix |
optional, default is 'pctile.text.' This is a text string specifying the first part of the desired resulting fieldname in outputs. |
basenames |
optional, default is 'pctile.xxx' where xxx is colnames(pctile). Defines colname(s) of outputs, which are the prefix plus this. |
Note pctile should be a (vector? or) data.frame of percentiles as INTEGER 0 to 100, NOT 0 to 1! Because that is how EJSCREEN data are stored. Might add code to handle cases like only one row, matrix not df, etc? Assume normal EJSCREEN pctile cols here would be like pctile.EJ.DISPARITY.pm.eo and then output popup col would be like pctile.text.EJ.DISPARITY.pm.eo In EJSCREEN, there are three types of pctile.text fields: E (text varies), D, EJ: 'pctile.text.cancer' "55 lifetime risk per million (91 'pctile.text.pctmin' "13 'pctile.text.EJ.DISPARITY.cancer.eo' "36
Returns character vector or data.frame, same shape as pctile.
make.popup.d
make.popup.e
make.popup.ej
pctileAsText
test1 <- structure(list(
pctile.EJ.DISPARITY.pm.eo = c(43.1816682334032, 27.4198086017171, 71.7852110581344, NA),
pctile.EJ.DISPARITY.o3.eo = c(47.1675935028896, 33.9578650432096, 69.7501760334948, NA)),
.Names = c("pctile.EJ.DISPARITY.pm.eo", "pctile.EJ.DISPARITY.o3.eo"),
row.names = c(1L, 2L, 3L, 126L), class = "data.frame")
test1
# pctile.EJ.DISPARITY.pm.eo pctile.EJ.DISPARITY.o3.eo
#1 43.18167 47.16759
#2 27.41981 33.95787
#3 71.78521 69.75018
#126 NA NA
test2 <- structure(list(
pctile.text.EJ.DISPARITY.pm.eo = c("43%ile", "27%ile", "71%ile", NA),
pctile.text.EJ.DISPARITY.o3.eo = c("47%ile", "33%ile", "69%ile", NA)),
.Names = c("pctile.text.EJ.DISPARITY.pm.eo", "pctile.text.EJ.DISPARITY.o3.eo"),
row.names = c(1L, 2L, 3L, 126L), class = "data.frame")
test2
# pctile.text.EJ.DISPARITY.pm.eo pctile.text.EJ.DISPARITY.o3.eo
#1 43%ile 47%ile
#2 27%ile 33%ile
#3 71%ile 69%ile
#126 <NA> <NA>
make.popup.ej(test1)
# pctile.text.EJ.DISPARITY.pm.eo pctile.text.EJ.DISPARITY.o3.eo
#1 43%ile 47%ile
#2 27%ile 33%ile
#3 71%ile 69%ile
#4 <NA> <NA>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.