The objective of this manual is to guide user to manage and analyse data using R Studio.

This manual consist a compilation of codings/ commands that were used to perform common data management and statistical analysis.

There are three parts that will be discussed in this manual with some introduction for the first time user:

  1. Data Management
  2. Descriptive Statistics
  3. Basic Inferential Statistics

Introduction

R Interface

For first time user or new beginner of R, below are some introduction of R interface.

When open Rstudio, you can see this interface

To open the code editor,please follow the steps as in the picture below

Then it will look like this

Notes:

  • Code editor is where you write, edit and save the R script/code/command. Once u run the script, the result/output will come out at R console
  • R Console is where the command and the results/ output will be displayed
  • Environment folder is where all the variables are listed

Creating Project

To start working with R, it is advisable to create a “project” where you can add all the folders or files needed.

(1) To create project, click on New Project> New Directory> New Project

(1) To create project, click on New Project> New Directory> New Project

(2) Create a folder name by inserting XXX study in the Directory name box. (3) Click browse to set the directory (4) Once finish, click Create Project box and you will be directed into the XXX Study project

(2) Create a folder name by inserting “XXX study” in the “Directory name” box. (3) Click browse to set the directory (4) Once finish, click “Create Project” box and you will be directed into the XXX Study project

Importing Data into Excel

For this exercise, please upload the following dataset:

Download data data_example1.xlsx here

Provided also is the dictionary for your reference

Download data_example1’s dictionary here

Please follow steps below to import data from excel to R

(1) Copy the data_example1.xlsx data and paste into the XXX Study project. (2) Click Import Dataset and choose From Excel from the dropdown list.

(1) Copy the “data_example1.xlsx” data and paste into the XXX Study project. (2) Click Import Dataset and choose From Excel from the dropdown list.

(3) An Import Excel Data dialog box will prompt out. Click Browse and select data_example1.xlsx from the file directory. (4) Create Data Name by typing data into the name box and Click Import once you have finished.

(3) An Import Excel Data dialog box will prompt out. Click Browse and select data_example1.xlsx from the file directory. (4) Create Data Name by typing “data” into the name box and Click Import once you have finished.

Your data will be displayed as below