Reading Data and Plotting in R

In this short exercise we will quickly go through how to read in a simple table of data and plot it using R.
First go to your work directory, or create one if you have not yet, and download these sample tables into this directory (right click on the link below and select save link). Next launch R and set the work directory by going to file->set work directory in windows, or by typing setwd(dir) in the command line in windows or linux where dir is the absolute path name. e.g. if your work directory is in c:/astronomy/work you must type in the entire path.
Sample Table (csv)
Sample Table (tabed)
Now you are ready to read the table into R. There are a few different commands that can be used to acomplish this task, but usually one is better than the others based ont he type of file you are working with. Here you are given two common types of files - a csv, or Comma Seperated Values, table and a tab seperated table. The respective commands to read in each type of table are var=read.csv("samplecsv.txt") and var2=read.table("sampletab.txt"). You can try using the commands in reverse, but you will not always get what you expected. You can find a full list of read commands by typing in help(read)