ibecav / CGPfunctions

Powell Miscellaneous Functions for Teaching and Learning Statistics
Other
27 stars 11 forks source link

formatting numbers in newggslopegraph #37

Closed gilmeriken closed 4 years ago

gilmeriken commented 4 years ago

First, thanks for creating newggslope graph, it looks great.

How do I control the number format of the Measurement? For example, what if I want the graph to display "X %", or if I want integers displayed with a thousands separator?

ibecav commented 4 years ago

Hi, looks like a good suggestion. I'll try and add it this week. I'll probably change things so that you can pass along a column name that contains labels formatted anyway you like.

gilmeriken commented 4 years ago

Thanks!

ibecav commented 4 years ago

Should be available in github via

development version from GitHub

install.packages("devtools")

devtools::install_github("ibecav/CGPfunctions", build_vignettes = TRUE, upgrade = "ask")

ibecav commented 4 years ago

Some examples of how to use it...

newcancer$datalabel <- paste0(newcancer$Survival, "%")
newggslopegraph(newcancer, Year, Survival, Type, Data.label = datalabel)
newcancer <- 
   newcancer %>% 
   mutate(datalabel = case_when(Type == "Thyroid" ~ "Humma", 
                                TRUE ~ NA_character_))
newggslopegraph(newcancer, Year, Survival, Type, Data.label = datalabel)