I use sitools to format the tick labels on my ggplot2 charts. When I deal with large numbers, the largest major tick label ends up being "NANA" and a warning message is displayed in the console:
Warning message:
In number/sifactor[ix] :
longer object length is not a multiple of shorter object length
library(ggplot2)
library(sitools)
data <- data.frame(list(
Quarter=as.factor(c("Q1 2015","Q2 2015","Q3 2015","Q4 2015","Q1 2016")),
Operations=c(23000000,54000000,120000000,450000000,12000000)
))
line_chart <- function(df, x, y, tit, xtit, ytit) {
return(
df %>% ggplot(aes_string(x=x, y=y)) +
geom_bar(stat = "identity", size=1) +
xlab(xtit) +
ylab(ytit) +
scale_y_continuous(labels = f2si) +
ggtitle(tit)
)
}
line_chart(df=data,
x="Quarter",y="Operations",
tit="OPERATIONS BY QUARTER",
xtit="QUARTER", ytit="OPERATIONS")
Thanks a lot