df = data.frame(year = seq(0,20))
df$sum  <- 100*1.1^df$year
ggplot(data=df, aes(x=year, y=sum)) + geom_line() + scale_y_continuous(limits = c(0, 700))
ggsave("logs1R.png#", units="cm", width=20, height=11)

df$logsum  <- log10(df$sum)
ggplot(data=df, aes(x=year, y=logsum)) + geom_line()
ggsave("logs2R.png", units="cm", width=20, height=11)

df$lnsum  <- log(df$sum)
ggplot(data=df, aes(x=year, y=lnsum)) + geom_line()
ggsave("logs3R.png", units="cm", width=20, height=11)

df <- data.frame(x = seq(0.1,100,0.1))
df$y = log(df$x)
ggplot(data=df, aes(x=x, y=y)) + geom_line() +
  geom_vline(xintercept = c(5,10,40,80), color="red") +
  geom_hline(yintercept = log(c(5,10,40,80)), color="red") +
  scale_x_continuous(name="X", breaks=seq(0, 100, 10))
ggsave("logs4R.png", units="cm", width=20, height=11)

library(ggplot2)
c19 <- data.frame(mon = c(2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
                  day = c(29, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21),
                  cases = c( 1, 2, 6, 13, 18, 19, 21, 24, 34, 43, 70, 90, 129, 169, 223, 292, 366, 557, 683, 785))
c19$date <- as.Date(sprintf("2020-%d-%d", c19$mon, c19$day))
ggplot(data=c19, aes(x=date, y=cases)) + geom_line()
ggsave("irecovidlinearR.png", units="cm", width=20, height=11)

c19$lc <- log(c19$cases)
ggplot(data=c19, aes(x=date, y=lc)) + geom_line()
ggsave("irecovidlogR.png", units="cm", width=20, height=11)

ggplot(data=c19, aes(x=date, y=cases)) +
  geom_line() +
  scale_y_continuous(trans='log10')
ggsave("irecovidlogscaleR.png", units="cm", width=20, height=11)

summary(modc19 <- lm(data=c19, lc ~ date))

c19$lyhat <- predict(modc19)
c19$elyh <- exp(c19$lyhat)
c19$elyh2 <- c19$elyh * exp(summary(modc19)$sigma^2/2)
ggplot(c19, aes(x=date, y=cases)) +
    geom_line() +
    geom_line(aes(x=date, y=elyh2), color="green") +
    scale_y_continuous(trans='log10')
ggsave("irecovidlogregR.png", units="cm", width=20, height=11)
