Statistics for Laboratory Scientists - Installation ToDo

The below instructions are for installing the RStudio environment you need for your homeworks on your laptop, which I recommend. Since computing will not be substantial, there are also free instances in the cloud you can use. Posit (the company behind Rstudio) offers free cloud accounts for limited computing. Sciserver, run by JHU, has a free rstudio instance.

Installing R, R Studio, and the knitr / rmarkdown packages on your laptop

Follow this link to install the lastest version of R. That is version 4.3.2, as of January 4, 2024.

Open R by double clicking on the GUI, or typing R at the command line (OS X, Linux).

After the prompt (the > sign), type install.packages("knitr")

If prompted for a mirror, 0 is the cloud and recommended.

After the prompt (the > sign), type install.packages("rmarkdown")

Close your R session.

Install the lastest version of R Studio. That is version 2023.12.0 Build 369, as of January 4, 2024.

Open R Studio by clicking the icon.

Check that you can knit a R markdown file to a html file

Download a Rmd file to your laptop, for example this test file. Make sure no extensions such as ".txt" get added when you save the file to your computer, the file name needs to end in ".Rmd". If your operation system causes problems and keeps regarding it as a ".txt" file, you can also create your own Rmd in RStudio (File -> New File -> R Markdown...).

Open the Rmd file in R Studio (File -> Open File). You should see the code in the upper left panel of R Studio. You should also see the name of the Rmd file in a tab. It needs to end in .Rmd, otherwise it is not properly recognized. If it ends in .txt, your OS added this extension. Close R Studio, fix the Rmd file name, and re-open R Studio, and the Rmd file.

You should also see a 'knit html' tab in this window. Click on it to knit a html file of your Rmd file. If R Studio complains about missing packages, close R Studio, open R again, install the packages it complains about using the install.packages() function, close R, re-open R Studio, and knit the html.

Check that you can knit a R markdown file to a pdf file

Click on the arrow to the right of the tab, and change the 'knit html' tab to 'knit to pdf'. Click on it to knit a pdf of your Rmd file.

If you get an error message, close R Studio, read about knitr in R Studio and install LaTeX (full distribution) or tinytex (smaller distribution). The easiest is probably to just type install.packages("tinytex") at the prompt.

Re-open R Studio, and knit the pdf.

Install the SPH.140.615 R package

After the prompt (the > sign) in R Studio, type the following three lines:

install.packages("devtools")
library("devtools")
devtools::install_github("bllfrg/SPH.140.615")


If you run into problems you can't solve after some tinkering, come see us.