R Programming Language Basics

From Ittichai Chammavanijakul's Wiki
Revision as of 09:59, 9 March 2014 by Ittichai (talk | contribs) (Created page with "* Set working directory <pre> > setwd('~/Desktop/R_scripts') </pre> * Read data <pre> > data=read.table('Statistic.csv') </pre> * Review data <pre> > data 1 A 2.0 2 B ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  • Set working directory
> setwd('~/Desktop/R_scripts')
  • Read data
> data=read.table('Statistic.csv')
  • Review data
> data
1    A    2.0
2    B    3.0
3    C    4.0
  • Assign a specific column to variable
> grade=data[,2]
  • Plotting
> plot(grade, xlab='Name', ylab='Score', ylim=c(1,3)
> boxplot(grade, xlab='Name', ylab='Score', ylim=c(1,3)
  • View basic arithmetic summary data
> summary
Min.