Вы находитесь на странице: 1из 4

R ëk¡ Œ Ü © I /O ¼ ê Ñ kfile ë ê.

§ Œ ± ´  ½ ¶ ¡ ½ ë   i Î x[i,j]
x[i,]
eI(i,j)ƒ
1i1
G. file="" ¿ › X I O Ñ \ ½ Ñ Ñ. ë (Connections)Œ ±  º ©
‡(file),+(pipes),Ø ©‡(zipped files)½ R Cþ. x[,j] 1j
by Tom Short, EPRI PEAC, tshort@epri-peac.com 2004-10-21 x[,c(1,3)] 11Ú3
translated by SZ Liu, sunbjt@hotmail.com 2006-09-22 3 windows öŠ‚¸e.©‡¦^Œ±ÏLi†(clipboard)
ª.Ö Excel L,Œ±ò Excel ¥ê‖i†,¦^ x["name",] ¶"name"1
Granted to the public domain. See www.Rpad.org for the source and latest êⵍI(Ý
I\eã)
version. Includes material from R for Beginners by Emmanuel Paradis (with x <- read.delim("clipboard")ªÖêâ.XJ‡òêâ\
i†ø Excel ¦^,Œ±¦^ x[["name"]] ¶"name"
permission). x$name Óþ.
version 1.0 2006-09-22 write.table(x,"clipboard",sep="\t",col.names=NA)
ê⥐¡pA^,ž„RODBC, DBI,RMySQL, RPgSQL, and ROracle÷
. ÖÙ¦©‡‚ªëXML, hdf5, netCDF ÷.
êâMï CþC†
¼Ï c(...) ~„ò˜Xëê=z•þ¼ê; ÏLrecursive=TRUE as.array(x), as.data.frame(x), as.numeric(x),
ŒÜ©R ¼êÑk3‚© "help(topic) 'utopic© . üSüL¿|ܤkƒ•þ. as.logical(x), as.complex(x), as.character(x),
?topic Óþ from:to )˜‡S; “:” kp?O`k?; 1:4 + 1 “2,3,4,5” ... =†Cþa.; ¦^Xe·-ÜL, methods(as)
help.search("topic") |¢ÏXÚ seq(from,to) )˜‡Sby= ½OÌ; length= ½‡¦Ý
apropos("topic") ˆ£¤k3|¢´»e÷vKLˆª”topic” seq(along=x) generates 1, 2, ..., length(along); useful for for Cþ&E
¤k閶¡ loops is.na(x), is.null(x), is.array(x), is.data.frame(x),
help.start() HTML/ªÏ rep(x,times) ­ Ex timesg; ¦ ^each= 5 ­ Ex ƒeach g; is.numeric(x), is.complex(x), is.character(x),
str(a) w«R é–S3á5(*str*ucture)½{‡`²é– rep(c(1,2,3),2) 1 2 3 1 2 3; rep(c(1,2,3),each=2) 1 ... uCþa.; ¦^Xe·-ÜL, methods(is)
summary(a) ‰ÑaV‡, Ï~´˜‡˜„5ÚOV‡;…§kØÓ 12233 length(x) x¥ƒ‡ê
ÅnÚaá5 data.frame(...) M ï ê â µ,C þ Œ U  · ¶ ½ ™  · ¶; dim(x) ­#˜½˜é–‘ê; dim(x) <- c(3,2)
ls() w«|¢´»eé–; ½pat="pat"ž,Uª^‡|¢ data.frame(v=1:4,ch=c("a","B","c","d"),n=10); ƒ é  á dimnames(x) ­#˜½˜é–¶¡
ls.str() str() |¢´»ez‡Cþ •þ¬W¿•þÝ nrow(x) 1‡ê; NROW(x) Š^ƒÓ,´§r•þw‰˜‡ü1
dir() 3c8¹ew«©‡ list(...) MdCþ|¤L,CþŒU·¶½™·¶; Ý

methods(a) w«a“S3 methods” list(a=c(1,2),b="hi",c=3i); ncol(x) ÚNCOL(x) Óþ.


methods(class=class(a)) L¤kŒ±)ûáué–a{ array(x,dim=) )dx|¤ê|;¦^aqdim=c(3,4,2)½‘ class(x) ½˜xa;class(x) <- "myclass"
ê; XJxØ
Ý,KxgÄ̂ unclass(x) íØxa
Ñ\†ÑÑ matrix(x,nrow=,ncol=) Ý
;Óþ attr(x,which) ½˜xá5a.which
load() \1dsave·-ê| attributes(obj) ½˜obj á5L
factor(x,levels=) r•þx ?褏Ïf.
data(x) \1½ê|
library(x) \1 ÷
gl(n,k,length=n*k,labels=1:n) Ï L  ½ Y ²  ª  ) Y êâÀÚöŠ
²(Ïf); k Y²‡ê; n ­Egê
read.table(file) Ö  L ‚ ª  © ‡ ¿ ò Ù M ï ¤ ê â µ;% which.max(x) ˆ£x¥ŒƒI
expand.grid() •þÚÏf|ܤêâµ
@©Îsep=""?¿whitespace;¦^header=TRUE Ö1˜ which.min(x) ˆ£x¥ƒI
rbind(...) r±1/ª|ÜÝ
,êâµ,½Ù¦
1 Š   I K;¦ ^as.is=TRUE“ Ž i Î • þ C factors;¦ rev(x) €=x¥¤kƒ
cbind(...) Óþ.±/ª
^comment.char=""“Ž"#")º5º; ¦^skip=n 3Öê sort(x) ,Süx¥ƒ;üSü¦^:rev(sort(x))
âcaLn 1;[„Ï'u1·¶,NA ?n,ÚÙ¦ êâƒÚ©l cut(x,breaks) òx©¤Aã(½Ïf);breaksã꽩:•
read.csv("filename",header=TRUE) Óþ,%@˜ÖÏ •þI þ.
:©©‡ x[n] 1n‡ƒ match(x, y) ˆ£˜‡ÚxƒÓ݅Úy¥ƒƒ•þØK
read.delim("filename",header=TRUE) Ó þ,% @  ˜  Ö x[-n] Ø
1n‡ƒx ˆ£NA
tab ©©‡ x[1:n] cn‡ƒ which(x == a) XJ'öŠý(TRUE),ˆ£•þx.
read.fwf(file,widths,header=FALSE,sep="" ,as.is=FALSE) x[-(1:n)] 1n+1 – ƒ choose(n, k) |ÜêOŽ
±f ixed width f ormatted/ªÖêâ–êâµ; widths ´ê x[c(1,4,2)] ½ƒ na.omit(x) Ø"”Š(NA)(؃'1XJx Ý
½êâµ)
•þ, ^u˜N°Ýiã x["name"] ¶"name"ƒ na.fail(x) ˆ£†Ø&EXJx¹–˜‡NA
save(file,...) ±Ø©²?›½é– x[x > 3] ¤kŒu3ƒ unique(x) XJx•þ½êâµ,ˆ£Ž˜Š
save.image(file) ¤ké– x[x > 3 & x < 5] «m(3,5)ƒ table(x) ˆ£˜‡dx Øӊ‡ê|¤L‚(~^uê½Ïf),=
cat(..., file="", sep=" ") r›=ziÎ ‹<arguments; x[x %in% c("a","and","the")] ‰½|¥ƒ ªêL
sep argumentsm©iÎ LI subset(x, ...) Š â ^ ‡(...À x¥   ƒ,X:x$V1 < 10); X
print(a, ...) w«arguments; ˜„5, …§kØÓÅnÚaá x[n] Lw«ƒn Jxêâµ,À‘select¦^K҉Ñ3½ØCþ
5 x[[n]] L1n‡ƒ sample(x, size) Ø ˜ £  ‘ Å 3 • þx¥ Ä size‡  ƒ,À
format(x,...) ‚ªz,Ðw«R é– x[["name"]] ¶"name"ƒ ‘replace = TRUE#N˜£Ä
write.table(x,file="",row.names=TRUE,col.names=TRUE, x$name Óþ. prop.table(x,margin=) Šâmargin ¦^©êL«L‚,Ãmargin
sep=" ") 3rx=zêâµ ,©‡; XJquote TRUE, Ý
I ž,¤kƒÚ1
iÎÚÏfÒ¬(")¤Œ; sep ´i㩅Î; eol —1 êÆ
©Î; na "”ŠiÎG; ¦^col.names=NA O\IK±
BuÚL‚Ñ\˜— +,-,×,÷,ˆ
sink(file) ÑÑ©‡file, †Ñ\·-sink() sin,cos,tan,asin,acos,atan,atan2,log,log10,exp
max(x) ˆ£xŒƒ p?êâ?n as.Date(s)Úas.POSIXct(s)=zˆgá5;format(dt)=z
min(x) Óþ. apply(X,INDEX,FUN=) Šâê|eI(INDEX) A^¼êFUN ˆ£• iÎLˆ.%@i΂ª“2006-07-24”.¦‚ɘ‡g‡Lˆ5
range(x) ˆ£c(min(x), max(x)) þ,ê|½LŠ ½=z‚ª.˜
~„‚ª:
sum(x) x¥ˆƒ\Ú lapply(X,FUN) A^FUN LXz‡ƒ %a, %A °{Úð{“(ÏU”(weekday)¶
diff(x) •þx © tapply(X,INDEX,FUN=) apply FUN to each cell of a ragged array given %b, %B °{Úð{¶
prod(x) x¥ƒë¦ by X with indexes INDEX %d °¥FÏ(01–31).
mean(x) xþŠ by(data,INDEX,FUN) apply FUN to data frame data subsetted by INDEX %H ž(00–23).
median(x) x¥ ê merge(a,b) Šâk½1¶rü‡êâµÜ¿ %I ž(01–12).
quantile(x,probs=) ÷ v ‰ ½ V Ç    ©   ê(% @ xtabs(a b,data=x) l©aÏféL %j c°¥FÏ(001–366).
0,.25,.75,1) aggregate(x,by,FUN) òêâµx ©A‡f8, …OŽˆ‡f %m °(01–12).
weighted.mean(x, w) \²þ 8V‡ÚO, ¿…±Ü·ªˆ£(J; by´©|ƒL %M ©¨(00–59).
rank(x) x¥ƒ stack(x, ...) ò©m/ªêâµ½L¥êâCþ=z %p AM/PM «.
var(x) or cov(x) •þx ; XJx´Ý
½êâµ, Ý ü %S ›?›¦(00–61).

òOŽ unstack(x, ...) stack()_L§ %U (Ï(00–53);1˜‡(ÏUŠ1˜‡(Ï1˜U.
sd(x) xIO ; sd(x)=sqrt(var(x)) reshape(x, ...) reshapes a data frame between ’wide’ format with %w (ÏUê(0–6,±F0).
cor(x) XJx´Ý
½êâµ,ˆ£ƒ'
(1 XJx•þ) repeated measurements in separate columns of the same record and %W ±(00–53);1˜‡±˜Š1˜‡(Ï1˜U.
var(x, y) or cov(x, y) xÚym ; XJx,yÝ
½êâµ,ˆ ’long’ format with the repeated measurements in separate records; %y íVc(00–99).؇¦^.
£xÚyˆ use (direction=”wide”) or (direction=”long”) %Y k­Vc.
cor(x, y) xÚy‚5ƒ'Xê;½öƒ'
,XJxÚyÝ
½êâµ
round(x, n) xê,°(n  iÎ %z (ÑÑ.)‚%£Ö€;-0800‚%£Ü 8 ž.
paste(...) =ziÎ ë•þ;sep= ©.(˜‡˜‚% %Z (ÑÑ.)ž«ŠiÎG(Ϙ).
log(x, base) OŽx±baseÄéê,%@ďexp(1)
scale(x) X Jx ´ ˜ ‡ Ý
,K ¥ % z Ú I O z ê â;e  I O z @); ÀJcollapse= Œ±©“collapsed”(J 3Ñў¬-,w«S¥êic"¯K,Ñ\žŒ±ÀJ.ë
K ¦ ^ À ‘center=FALSE, e  ¥ % z ¦ ^scale=FALSE (% substr(x,start,stop) JiΕþfiã;ÓŒ±DŠ,¦ „?strftime.
@center=TRUE, scale=TRUE) ^substr(x, start, stop) <- value
pmin(x,y,...) x[i], y[i]ƒ'ö,|¤#•þ strsplit(x,split) 3split ˜©x
pmax(x,y,...) Óþ.Œö grep(pattern,x) |¢x¥÷vpattern^‡;ë„?regex
cumsum(x) dx|¤•þ,x[i]=sum{x[1]:x[i]} gsub(pattern,replacement,x) O † ÷ v  K L ˆ ª  i ±ã
cumprod(x) Óþ.ë¦ ã,sub() aq,–O†1˜‡Ñyiã plot(x) 3xþà/±›xŠ(y¶þ)
cummin(x) Óþ. tolower(x) =zlowercase plot(x, y) VCþ±ã
cummax(x) Óþ.Œ toupper(x) =zuppercase hist(x) xªê†ã
union(x,y), intersect(x,y), setdiff(x,y), setequal(x,y), match(x,table) table¥šxƒ ˜|¤•þ. barplot(x) xªê^.ã;¦^horiz=FALSEUC±ãY²½R†
is.element(el,set) “set” ¼ê x %in% table Óþ.ˆ£Ü6•þ dotchart(x) XJxêâµ,±› Cleveland dot ã(stacked plots line-
Re(x) Eê¢Ü pmatch(x,table) table¥Ü©šxƒ by-line and column-by-column)
Im(x) JÜ nchar(x) i·ê pie(x) \ã
bcodeMod(x) ýéŠ;Óabs(x) FÏڞm boxplot(x) ‡‚ã
Arg(x) EêÝ(in radians) sunflowerplot(x, y) Óþ.´±ƒq‹I:Šsù§Ùs‹
Date ¹FÏ؝¹žm.POSIXct )FϞmڞ«&E. ƒ
Conj(x) complex conjugate ê8:‡ê
' ó(X.>),seq() Údifftime() 'k^.Date Œ±¦^+Ú−.
convolve(x,y) compute the several kinds of convolutions of two se- coplot(x˜y | z) Šâz Š½Šm…±›x Úy VCþã
?DateTimeClassesŒ±‰Ñõ&E.„chron÷.
quences interaction.plot (f1, f2, y) XJf1Úf2´Ïf§ŠyþŠ
fft(x) Fast Fourier Transform of an array 㧱f1ØӊŠx¶§ f2ØӊéAØÓ­‚:Œ±
mvfft(x) FFT of each column of a matrix ^À‘fun½y Ù¦ÚOþ("ŽOŽþŠ,fun=mean)
filter(x,filter) applies linear filtering to a univariate time series or matplot(x,y) ã,Ù¥x 1˜éAy1˜, x 1é
to each series separately of a multivariate time series Ay 1, gaí"
ŒõêƼê¦^Ü6ëêna.rm=FALSE5½´Ä£Ø"”Š(NA). fourfoldplot(x) ^ o ‡ o © ƒ ˜ w «2×2 é L œ ¹(x7 L
Ý
´dim=c(2, 2,k)ê|, ½ö´dim=c(2, 2) Ý
§XJk =
1)
t(x) =˜
assocplot(x) Cohen–Friendlyã,w«3‘éL¥1,Cþ l
diag(x) é

Õá5§Ý
%*% Ý

mosaicplot(x) éLéê‚5£8í êmŽã
solve(a,b) $Ža %*% x = b x
pairs(x) XJx ´Ý
½´êⵧŠx ˆƒmã
solve(a) Ý
_
plot.ts(x) XJx´ats é–,Šx žmS­‚,xŒ±´õ
rowsum(x) Ý
‚ªé–1\Ú; rowSums(x) ´˜‡¯‡
, ´S7LkƒÓªÇڞm
colsum(x), colSums(x) Óþ.
ts.plot(x) Óþ,XJx´õ§SŒkØÓžmLkƒ
rowMeans(x) 1²þ

colMeans(x) ²þ
qqnorm(x) © ê–© êã
qqplot(x, y) éx© ê–© êã
contour(x, y, z) ± ›  p ‚ ã(x ­ ‚ ž ¦ ^ S  O † bg  ½  µ ô Ú(X: bg="red", bg="blue", . . . ^colors()Œ ± w 3 ˜ „ 5Lattice ú ª ¥, y x|g1*g2k Œ À J ^ ‡ C þg1 Úg2 | Ü
Ö ¿ ˜ x  Š), x Úy 7 L  • þ,z 7 L  Ý
,¦ «657«Œ^ôÚ¶) ± › 3 ü Õ “panels”þLattice ¼ ê ¦ ^
é õ ƒ Ó  ë þ Š  Ä
dim(z)=c(length(x),length(y)) (x Úy Œ±ŽÑ) bty ››ã/>µ/G,Œ¦^Š:"o", "l", "7","c", "u" ½"]" (> :N\±ã,Xdata=,subset=. ¦^panel= 5½Â½›“panel”¼ê(ë
filled.contour(x, y, z) Óþ,p‚ƒm«´çÚ,¿… µÚiΎ”);XJbty="n" Kر›>µ apropos("panel")Ú?llines). Lattice ¼êˆ£˜‡trellis a.é
±›çÚéAŠã~ cex ››"ŽGeÎÒÚ©iŒŠ;e¡ëêkÓõU: –¿…´“print-ed”5)¤ã/. Sܦ^print(xyplot(...))¼ê
image(x, y, z) Óþ,´¢SêâŒ^ØÓÚçL« cex.axis, ‹I¶Ý, cex.lab, ‹I¶I\, cex.main, IK, ž,gıã¿ÃJ. ¦^lattice.theme Úlset 5UCLattice %@
persp(x, y, z) Óþ,ßÀã cex.sub,BIK ˜.
stars(x) XJx ´Ý
½öêâµ,^(/ڂãxÑ,(“Lx z col › › Î Ò Ú ë ‚  ô Ú;¦ ^ ô Ú ¶ ¡: "red", "blue" ë
˜1‚ã“LÝ. colors() ½ Š "#RRGGBB"; ë rgb(), hsv(), gray(),
.[Ú
symbols(x, y, ...) 3dx Úy ‰½‹IxÎÒ( §/§ Úrainbow(); Óëêcex aq: col.axis, col.lab, col.main, optim(par, fn, method = c("Nelder-Mead", "BFGS",
/§(§§ÝOª½öÝ/ã), ÎÒa.!Œ!ôÚ col.sub "CG", "L-BFGS-B", "SANN") general-purpose optimization;
d, Cþ½ font ››©iNê(1: ~, 2: N, 3: oN, 4: oN); „Œ± par is initial values, fn is function to optimize (normally minimize)
termplot(mod.obj) ±›£8.(mod.obj)( )Kã ¦^font.axis, font.lab, font.main, font.sub nlm(f,p) ŠâЩŠÏL¦^Úî(Newton-type)Ž{z¼ê
e¡ëê²~^u˜„±ã¼ê las ››‹I¶ÝêiIP•ê(0: ²1u¶, 1: îü, 2: R† lm(formula) [ڂ5.; formula;./ª
add=FALSE XJTRUE,3c˜‡ãþ(XJ3)V\±ã u¶, 3: çü) response ˜ termA + termB + ...; ¦ ^I(x*y) + I(xˆ2) 5
axes=TRUE XJFALSE,رыI¶ÚÝf lty ››ë‚a.,Œ±´ê½iÎ(1: "solid", 2: "dashed", 3: ¤š‚5¤©
type="p" ½±›ãa.,"p": :,"l": ‚,"b" ^‚ë:, "o": "dotted", 4: "dotdash", 5: "longdash", 6: "twodash"),½Ø‡ glm(formula,family=) ÏL½‚5ýÿ.Úí ©Ù5[
Óþ.‚BL:,"h": R†‚, "s": F,êâdR†‚º L8‡iÎiÎG("0"–"9"mê)O½‚Ú˜x Ú2‚5.; familyí ©Ù£ã…Ó.Ü;
à“L, "S": F,êâdR†‚.à“L Ý),ü –(”points”)ڔƒ,Xlty="44" Últy=2 ˜ „?family
xlim=, ylim= ½‹I¶ځŒ› lwd ››ë‚°Ýêi,%@1 nls(formula) š‚5¦O
xlab=, ylab= 5º‹I¶ mar ››ã/>˜k4‡Š•þc(bottom, left, top, right),% approx(x,y=) linearly interpolate given data points; x can be an xy plot-
main= ÌIK @Šc(5.1, 4.1, 4.1, 2.1) ting structure
sub= BIK(ÒiN) mfcol ^c(nr,nc) •þ©±ãInr 1Únc ,U¦^fI spline(x,y=) cubic spline interpolation
mfrow Óþ.U1¦^fI loess(formula) ÛÜCq£8"|^ÛÜ\£8?1˜‡šë£
$Y²±ã·- pch ››ÎÒa.,Œ±´d1 –25 ê,½ö´"" pü‡iÎ 8"ù«£8éw«˜|'Ïê⪳ڣãŒêâ8
points(x, y) V\:(À‘type=Œ±¦^) 1 ● 2 3 4 5 6 7 8 9 10 ● 11 12 13 ● 14 15 Nœ¹š~k^"
lines(x, y) Óþ.^‚ 16 ● 17 18 19 ● 20 ● 21 ● 22 23 24 25 * * . X X a a ? ? éõ±úªÄ:.¼êkéõÏ^ëþ: data= úªCþ
text(x, y, labels, ...) 3 ‹ Ix,y \ \ © i; ; . A ps ››©iŒê§ü –(points)  ê â µ, subset= ÷ v ^ ‡  f 8; na.action= " ” Š ? n  ª:
^:plot(x, y, type="n"); text(x, y, names) pty ½±ã«a.iΧ"s": /, "m": Œ|^ "na.fail", "na.omit", ½˜‡¼ê. e¡~^u.[Ú¼ê:
mtext(text, side=3, line=0, ...) 3  ½ sideV \ © tck ½¶þÝÝŠ§ü ´z©'§±ã/°!p¥˜ predict(fit,...) ÏL[Ú.fit OŽýÿŠ
i(ëaxis);line½V\©i±ã« ‡ŠÄê¶XJtck=1 K±›grid df.residual(fit) ˆ£í gdÝ
segments(x0, y0, x1, y1) l:(x0,y0) y‚–:(x1,y1) tcl Óþ.±©1pݏÄê(%@tcl=-0.5) coef(fit) ˆ£OXê£kžÿ„)¦‚IO ¤
arrows(x0, y0, x1, y1, angle= 30, code=2) Ó xaxt X Jxaxt="n" K  ˜x-¶  Ø w «(k Ï u Úaxis(side=1, residuals(fit) ˆ£í Š
þ.code=2± :(x0,y0) Ä  :  † Þ, code=1± ...)˜å¦^) deviance(fit) ˆ£
:(x1,y1)  :  † Þ,code=3V † Þ; angle › › † Þ Ü yaxt Óþ. y-¶ fitted(fit) ˆ£[ڊ
mÝ logLik(fit) OŽéêq,ŠÚëêê8
abline(a,b) ±åaǏb‚ AIC(fit) OŽ Akaike &EOK£Akaike information criterion or AIC¤
abline(h=y) 3y:R‚
ÚO
abline(v=x) 3x:Y²‚  ‚ (Lattice)±
±ã aov(formula)  ©Û
abline(lm.obj) Šâlm.obj‰Ñ£8‚
xyplot(y˜x) VCþã anova(fit,...) ˜‡½õ‡.閐 L£½í ²ÚL¤
rect(x1, y1, x2, y2) ‰Ñ†,m,.,p›x1, x2, y1, and y2
barchart(y˜x) y éx †ã ©Û
o>/
dotplot(y˜x) Cleveland :ã(Å1Å\\ã) density(x) xؗÝO
polygon(x, y) õ>/Šã
densityplot(˜x) —ݼêã binom.test(), pairwise.t.test(), power.t.test(),
legend(x, y, legend) 3:(x,y)V\ã~
title() V\IK
histogram(˜x) xªÇ†ã prop.test(), t.test(), ... ¦^help.search("test")
bwplot(y˜x) Ý/ã
axis(side, at) V \ ‹ I ¶,. Ü(side=1), † ý(2), º Ü(3)½ m
qqmath(˜x) x 'u,nة٩ ê-© êã ©Ù
ý(4); ŒÀëêat ½xÝ‚ ˜‹I rnorm(n, mean=0, sd=1) pd()
stripplot(y˜x) ˜‘ã,x7L´êŠ., yŒ±´Ïf
rug(x) 3x-¶þ^á‚xÑêâx ˜ rexp(n, rate=1) ê
qq(y˜x) 'ü‡©Ù© ê, x7L´êŠ., yŒ±´êŠ,iν
locator(n, type="n", ...) 3^r¦^àI3ãþ:Âng rgamma(n, shape, scale=1) γ ©Ù
ö´Ïf,7L´ü‡“Y²”
ˆ£ng:‹I(x, y)¶¿Œ±3:Â?±›ÎÒ(type="p") rpois(n, lambda) Poisson ©Ù
splom(˜x) ‘ãÝ

½‚(type="l") §"Žœ¹eØxÎÒ½ë‚(type="n") rweibull(n, shape, scale=1) Weibull ©Ù


parallel(˜x) ²1‹Iã
±ãëê levelplot(z˜x*y|g1*g2) 3x§y ‹I:z ŠçÚŠ‚ã rcauchy(n, location=0, scale=1) Cauchy ©Ù
Œ±¦^par(...) 5[È5UC±ãëê;éõëꏌ±Š±ã £x§yÚz¤ rbeta(n, shape1, shape2) β ©Ù
·-À‘. wireframe(z˜x*y|g1*g2) 3d ßÀã(¡) rt(n, df) t©Ù
adj ››©iéàª(0 †éà, 0.5 Ø¥éà, 1 méà) cloud(z˜x*y|g1*g2) 3dßÀã(:) rf(n, df1, df2) F ©Ù
rchisq(n, df) χ2 ©Ù
rbinom(n, size, prob) ‘
rgeom(n, prob) AÛ
rhyper(nn, m, n, k) ‡AÛ
rlogis(n, location=0, scale=1) logistic ©Ù
rlnorm(n, meanlog=0, sdlog=1) éê
rnbinom(n, size, prob) K‘©Ù
runif(n, min=0, max=1) þ!©Ù
rwilcox(nn, m, n), rsignrank(nn, n) Wilcoxon ©Ù
¤k¼êь±¦^d, p or q 5O†r ©OVǗÝ(dfunc(x,
...)), \ÈVǗÝ(pfunc(x, ...)), © ê(qfunc(p, ...), 0 < p
< 1).


function( arglist ) expr ½Â¼ê
return(value)
if(cond) expr
if(cond) cons.expr else alt.expr
for(var in seq) expr
while(cond) expr
repeat expr
break
next
¦^Lˆ(statements)¦^Œ)Ò{}
ifelse(test, yes, no) XJ÷v^‡testˆ£yes,‡ƒˆ£no
do.call(funname, args) Šâ¼ê¶ÚLˆª(arguments)‰1N
^¼ê.

Вам также может понравиться