Liu-R-refcard - R k = d Tom Short [email protected]..

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: R k = d Tom Short [email protected] com > , 3 www.Rpad.org # . ( u N ) a q , V e Z- . Y? 9 o d 4 g K I , X k 1 X : [email protected],[email protected] 1.1 2007-1-23 : R k 3 " help(topic) ' u topic . ?topic help.search("topic") | X apropos("topic") k 3 | e v K L ”topic” k help.start() HTML / demo R U example(f) $ 1 3 ~ f str(a) w R S 3 5 (*str*ucture) { ` summary(a) a V , ~ 5 O V ; 5 a k . ls() w | e ; pat="pat" , U ^ | ls.str() str() | e z C dir() 3 c 8 ew list.files() getwd() & E setwd() & E methods(a) w a “S3 methods” methods(class=class(a)) L k u a { options(...) u ; ~ ^ k : width , digits , error library(x) 1 (package); library(help=x) w x datasets . require(x) attach(x) x R | ; x L , , d save M R data file. ^ search() 5 w | . detach(x) attach _ L . assign(x,value) value D x , = ” <- ” quit() c R { (q() Ctrl z) load() 1 d save- | data(x) 1 | edit N ^ ? 6 ? U R fix(x) ‘fix’ N ^ ‘edit’ ? U ‘x’ data.entry > f L / ? 6 scan(x) l L read.table(file) L M ; % @ sep="" ? whitespace; ^ header=TRUE 1 1 I K ; ^ as.is=TRUE i C factors; ^ comment.char="" "#" 5 ; ^ skip=n 3 c a L n 1 ; [ ' u 1 ,NA ? n , read.csv("filename",header=TRUE) , % @ : read.delim("filename",header=TRUE) , % @ tab read.fwf(file,widths,header=F,sep=" \ t",as.is=FALSE) f ixed w idth f ormatted / ; widths , ^u N i save(file,...) ? save.image(file) k dump("x","...") x 3 ”...” p cat(..., file="", sep=" ") r = z i < arguments; sep arguments m i print(a, ...) w arguments; , u k L . format(x,...) z , w R write.table(x,file="",row.names= T ,col.names= T , sep="") 3 r x = z , ; X J quote TRUE , i f ( " ) ; sep i ; eol 1 ; na " i G ; ^ col.names=NA O I K B u L sink(file) file ,- sink() I / O k file . ~ ^ i G 5 . file="" X I O . (Connections) (file), + (pipes), (zipped files) R C . 3 windows e . ^ L i (clipboard) . Excel L , Excel i , ^ x <- read.delim("clipboard") . X J i Excel ^ , ^ write.table(x,"clipboard",sep=" \ t",col.names=NA) p A^ , RODBC , DBI , RMySQL , RPgSQL , and ROracle . XML , hdf5 , netCDF . M c(...) ~ X = z ; L recursive=TRUE S L | k . from:to S ; “:” k p ? O ` k ? ; 1:4 + 1 “2,3,4,5” seq(from,to) S by= m ; length= seq(along=x) 1, 2, ..., length(along) ; ~ ^ 3 rep(x,times) E x times g ; ^ each= 5 x E g ; rep(c(1,2,3),2) 1 2 3 1 2 3; rep(c(1,2,3),each=2) 1 1 2 2 3 3 data.frame(...) M , C U ; data.frame(v=1:4,ch=c("a","B","c","d"),n=10) ; W list(...) M d C | L , C U ; list(a=c(1,2),b="hi",c=3i) ; array(x,dim=) d x | | ; ^ a q dim=c(3,4,2) ; X J x , K x g matrix(x,nrow=,ncol=) ; factor(x,levels=) r x ? f . gl(n,k,length=n * k,labels=1:n) L Y Y ( f ); k Y ; n E g expand.grid() J f k | rbind(...) r 1 / | , , cbind(...) . / x[n] 1 n x[-n] 1 n x x[1:n] c n x[-(1:n)] 1 n+1 x[c(1,4,2)] x["name"] "name" x[x > 3] k u 3 x[x > 3 & x < 5] m (3,5) x[x %in% c("a","and","the")] | L x[n] L w n x[[n]] L 1 n x[["name"]] "name" x$name ....
View Full Document

This note was uploaded on 04/16/2010 for the course UUI 88937 taught by Professor Johannajohanson during the Spring '10 term at Punjab Engineering College.

Page1 / 4

Liu-R-refcard - R k = d Tom Short [email protected]..

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online