Rlogo.jpg

Here is a comprehensive compilation of many R commands that most of the scientists can find useful for analyzing research data.

Basics

  • Check working directory:
getwd()
  • Change working directory:
setwd("path")
  • Show help about a command (quotes are important):
help("command")
?"command"
  • Show the objects and variables of the working space:
ls()
  • Remove an object from the working space:
rm(x)
rm(list=ls()) # Removes all the objects
  • Save the working space:
save.image() # in the file .RData at the working directory
save(object list,file="myfile.RData") # saves the object list into the chosen file
  • Reload a working space:
load("myfile.RData")
  • Quit R:
q()

Continue reading