This section is on the basics of using R for statistics. The range of areas covered includes the following.

Setting Up in R

  • Installing R and Setting Up RStudio: These include discussions on installing and setting up R and RStudio.

  • Working with Packages and Libraries, and Getting Help: These include discussions on functions like install.packages() to install a package, library() to load a package, and require(package) to load a package.

  • Basics for R Environment, Session, and Workspace: These include discussions on basics such as saving, loading and quitting R sessions; and saving, loading and displaying command lists. Using functions like save.image(), save(), load(), quit(), ls(), str(), rm(), rm(list = ls()), history(), savehistory(), and loadhistory().

  • How to Set and Get the Working Directory: These include discussions on setting and getting the working directory using the setwd() and getwd() functions respectively. With the working directory being the folder that contains the file(s) you want to work on or write into.

Basic Activities

  • Operations: These include discussions on operations such as arithmetic, relational, Boolean and logical operations performed on various data structures like vectors, matrices, and arrays, including dates and times.

  • Working with Dates and Times: These include discussions on functions to help work with dates and times in R. Functions such as Sys.time(), Sys.Date(), strptime(), format(), as.Date(), and ISOdatetime().

  • Replication and Sequence: These include discussions on how to use the rep() function for replication, and the seq() function for sequence generation.

  • Setting Seed for Reproducibility: These include discussions on how to use the set.seed() function to set seeds in R in order to be able to reproduce results.

Functions

Copyright © 2020 - 2024. All Rights Reserved by Stats Codes