In this template section you choose the appropriate code chunk to import your linelist dataset. The linelist Excel file can be downloaded from the case study overview page.
For this exercise our linelist dataset is a non-DHIS file, so to import we use the
read_nonDHIS_data code chunk.
Comment out (using #) or delete the
prep_DHIS_data chunks, as they are not necessary and will cause errors.
Importing the dataset into R
import() function of the rio package to import an Excel file that is not password protected. The
which= argument of
import() specifies that the sheet “linelist” should be imported.
import() function is wrapped around the
here() function. The
here() function makes it easy for R to locate files on your computer. It is best to save the dataset within an R project, and to provide
here() with any R project subfolder names. You can read more about
here() functions in the importing data R Basics page.
## Read data ------------------------------------ # Excel file # to read in a specific sheet use "which" linelist_raw <- rio::import(here::here("AJS_AmTiman.xlsx"), which = "linelist")
A successfull import should result in a dataframe object named
linelist_raw in your RStudio Environment pane, consisting of 1447 observations and 122 variables.