Difference between revisions of "R Programming Language Basics"
Jump to navigation
Jump to search
(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 ...") |
|||
Line 7: | Line 7: | ||
<pre> | <pre> | ||
> data=read.table('Statistic.csv') | > data=read.table('Statistic.csv') | ||
+ | |||
+ | # Need two backslashes for Windows file system | ||
+ | > data=read.table('C:\Documents\My R\Life Expentancy.txt') | ||
+ | Error: '\U' used without hex digits in character string starting "'C:\U" | ||
+ | |||
+ | > data=read.table('C:\\Documents\\My R\\Life Expectancy.txt') | ||
</pre> | </pre> | ||
Line 34: | Line 40: | ||
</pre> | </pre> | ||
+ | [[Category: R]] | ||
[[Category: Languages]] | [[Category: Languages]] |
Revision as of 10:05, 9 March 2014
- Set working directory
> setwd('~/Desktop/R_scripts')
- Read data
> data=read.table('Statistic.csv') # Need two backslashes for Windows file system > data=read.table('C:\Documents\My R\Life Expentancy.txt') Error: '\U' used without hex digits in character string starting "'C:\U" > data=read.table('C:\\Documents\\My R\\Life Expectancy.txt')
- 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.