I'm quite new to R.
The column "Popularity" of my dataSet "shp_poly1_simplified" consists of high numbers, partly millions. How can I change the notation in my code snippet from exponential notation to writing out the whole integer?
Here is what I have so far:
labels <- sprintf(
"<strong>%s</strong><br/>%g People / 2020 </sup>",
shp_poly1_simplified$UNIT_NAME, shp_poly1_simplified$Popularity
) %>%
lapply(htmltools::HTML)
When I use "%1.0f", just like this:
labels <- sprintf("%1.0f",
"<strong>%s</strong><br/>%g People / 2020 </sup>",
shp_poly1_simplified$UNIT_NAME, shp_poly1_simplified$Popularity
) %>%
lapply(htmltools::HTML)
there occurs the error:
Error in sprintf("%.0f", "<strong>%s</strong><br/>%g People / 2020 </sup>", :
invalid format '%.0f'; use format %s for character objects
Thank you very much.
%.0f People / 2020 ", shp_poly1_simplified$UNIT_NAME, shp_poly1_simplified$Popularity` – rawr Jun 28 '22 at 19:19