Just discovered Thunderbird conversations extension that displays Thunderbird emails like Gmail. Very cool.

# Shige's Research Blog

## Friday, February 26, 2021

## Thursday, February 25, 2021

### Convert email to event or task

I just found out that Thunderbird can convert an email into an event or task with deadline. This is extremely useful for me.

## Monday, February 15, 2021

### Using tikzDevice in R Markdown document

When I was LaTeX user in the past, I like TikZ and tikzDevice a lot. After switching to R Markdown, however, I gradually forgot about them. Today I spent some time figuring out how to make TikZ and tikzDevice work for R Markdown. Here is some simple code:

---

title: "Using tikzDevice"

output:

pdf_document:

latex_engine: xelatex

keep_tex: yes

includes:

in_header: setup.tex

---

```{r setup, include=FALSE}

knitr::opts_chunk$set(echo = FALSE)

```

```{r, fig.cap="Without tikzDevice"}

x<- rnorm(10)

y<-x +rnorm(5,sd=0.25)

model <- lm(y~x)

rsq<- summary(model)$r.squared

rsq<- signif(rsq,4)

plot(x, y, main='Hello \\LaTeX!')

abline(model,col='red')

mtext(paste("Linear model:$R^{2}=",

rsq, "$"), line=0.5)

legend('bottomright',legend=paste("$y = ",round(coef(model)[2],3),'x +',round(coef(model)[1],3),'$',sep =''), bty ='n')

```

```{r, echo=FALSE}

library(tikzDevice)

```

```{r, echo=FALSE, message=FALSE, results='hide'}

tikz('latexEx.tex',width=7,height=4.5)

x<- rnorm(10)

y<-x +rnorm(5,sd=0.25)

model <- lm(y~x)

rsq<- summary(model)$r.squared

rsq<- signif(rsq,4)

plot(x, y, main='Hello \\LaTeX!')

abline(model,col='red')

mtext(paste("Linear model:$R^{2}=",

rsq, "$"), line=0.5)

legend('bottomright',legend=paste("$y = ",round(coef(model)[2],3),'x +',round(coef(model)[1],3),'$',sep =''), bty ='n')

dev.off()

```

```{r, fig.cap="With tikzDevice", message=FALSE, engine='tikz'}

\input{latexEx.tex}

title: "Using tikzDevice"

output:

pdf_document:

latex_engine: xelatex

keep_tex: yes

includes:

in_header: setup.tex

---

```{r setup, include=FALSE}

knitr::opts_chunk$set(echo = FALSE)

```

```{r, fig.cap="Without tikzDevice"}

x<- rnorm(10)

y<-x +rnorm(5,sd=0.25)

model <- lm(y~x)

rsq<- summary(model)$r.squared

rsq<- signif(rsq,4)

plot(x, y, main='Hello \\LaTeX!')

abline(model,col='red')

mtext(paste("Linear model:$R^{2}=",

rsq, "$"), line=0.5)

legend('bottomright',legend=paste("$y = ",round(coef(model)[2],3),'x +',round(coef(model)[1],3),'$',sep =''), bty ='n')

```

```{r, echo=FALSE}

library(tikzDevice)

```

```{r, echo=FALSE, message=FALSE, results='hide'}

tikz('latexEx.tex',width=7,height=4.5)

x<- rnorm(10)

y<-x +rnorm(5,sd=0.25)

model <- lm(y~x)

rsq<- summary(model)$r.squared

rsq<- signif(rsq,4)

plot(x, y, main='Hello \\LaTeX!')

abline(model,col='red')

mtext(paste("Linear model:$R^{2}=",

rsq, "$"), line=0.5)

legend('bottomright',legend=paste("$y = ",round(coef(model)[2],3),'x +',round(coef(model)[1],3),'$',sep =''), bty ='n')

dev.off()

```

```{r, fig.cap="With tikzDevice", message=FALSE, engine='tikz'}

\input{latexEx.tex}

## Thursday, February 11, 2021

## Saturday, January 30, 2021

## Friday, January 08, 2021

## Wednesday, December 30, 2020

### Estimating and testing GLMs with `emmeans`

This post shows how to use *emmeans* package to generate first difference with confidence intervals.

## Monday, November 30, 2020

### Getting past the little hiccups to getting plotly animations into slides

Very helpful post regarding how to use plotly graph in xaringan slides.

Subscribe to:
Posts (Atom)