0.4 - Important R Code


At the end of each chapter, there will be a section highlighting the most important R code used. The dark text will never change but the lighter (red) text will need to be customized to your particular application. The sub-bullet for each function will discuss the use of the function and pertinent options or packages required. You can use this as a guide to finding the function names and some hints about options that will help you to get the code to work or you can revisit the worked examples using each of the functions.

  • FILENAME<-read.csv("path to save csv file/ FILENAME.csv")
    • Can be generated using "Import Dataset" button or by modifying this text.
    • To access a particular variable in a data.frame called DATASETNAME, use a $ and then the VARIABLENAME.
    • Provides a list of the first few rows of the data set for all the variables in it.
    • Calculates the mean of the observations in a variable.
    • Calculates the SD of the observations in a variable.
    • Provides a suite of numerical summaries of the observations in a variable.
    • Requires the mosaic package to be loaded (require(mosaic)).
    • Makes a histogram.
    • Makes a boxplot.