freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

從數(shù)據(jù)到結(jié)論(人民大學(xué)吳喜之教授)14統(tǒng)計(jì)軟件和r語(yǔ)言-文庫(kù)吧資料

2025-05-07 23:42本頁(yè)面
  

【正文】 b=T) ? 如果原先是 4?5有名字的 ,則用 ? x=(f:\\book\\,header=T) ? x GM VW HUNDA 1993 1 2 3 1994 6 7 8 控制語(yǔ)句 ?x=NULL。 tab=xtabs(~ Sex + Age, quine)。 (5。 (1。stem(scores,scale=2) The salaries could be placed into broad categories of 01 million, 15 million and over 5 million. To do this using R one uses the cut() function and the table() function. Suppose the salaries are again 12 .4 5 2 50 8 3 1 4 .25 And we want to break that data into the intervals [0。summary(sals) mean(sals,trim=1/10) 。 quantile(data,c(.25,.75)) sort(sals)。 summary(data)。 sd(sals) 。t correct ?barplot(table(beer)) Yes, call with summarized data ?barplot(table(beer)/length(beer)) divide by n for proportion table(beer)/length(beer) ?CEO salaries: Suppose, CEO yearly pensations are sampled and the following are found (in millions). (This is before being indicted for cooking the books.) 12 .4 5 2 50 8 3 1 4 ?sals = scan() read in with scan ?12 .4 5 2 50 8 3 1 4 ?mean(sals) 。x V1 V2 V3 1 1 3 5 2 2 4 6 ? x$V2 ? [1] 3 4 ? x$V2 ? [1] 3 4 ? attributes(x) $names [1] V1 V2 V3 $ [1] 1 2 $class [1] ? names(x)=c(TOYOTA,GM,HUNDA) ? (x)=c(2022,2022) ? x TOYOTA GM HUNDA 2022 1 3 5 2022 2 4 6 ? x$GM ? [1] 3 4 ? attach(x) ? GM ? [1] 3 4 ? detach(x) ? GM ? Error: Object GM not found 直接手工輸入和編輯數(shù)據(jù) ? 直接敲入 :x=c(1,2,7,8,… ) ? 或者 ? x=scan() ? 1 2 7 8 … .(以 “ Enter”兩次來(lái)結(jié)束 ) ? fix(x)(通過(guò)編輯修改數(shù)據(jù) ) Categorical data A survey asks people if they smoke or not. The data is Yes, No, No, Yes, Yes ?x=c(Yes,No,No,Yes,Yes) ?table(x)。z$T[[3]]。z$T。y=matrix(rnorm(20),4,5) ? y%*%x [,1] [,2] [,3] [,4] [,5] [,6] [1,] [2,] [3,] [4,] ? apply(x,1,mean) ? [1] ? apply(x,2,sum) ? [1] 15 40 65 90 115 140 ? apply(x,2,prod) ? [1] 120 30240 360360 1860480 6375600 17100720 Array的維運(yùn)算 ? x=array(1:24,c(4,3,2)) ? apply(x,1,mean) ? [1] 11 12 13 14 ? apply(x,1:2,sum) [,1] [,2] [,3] [1,] 14 22 30 [2,] 16 24 32 [3,] 18 26 34 [4,] 20 28 36 ? apply(x,c(1,3),prod) [,1] [,2] [1,] 45 4641 [2,] 120 5544 [3,] 231 6555 [4,] 384 7680 矩陣與向量之間的運(yùn)算 ? sweep(x,1,1:5,*) [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1 6 11 16 21 26 [2,] 4 14 24 34 44 54 [3,] 9 24 39 54 69 84 [4,] 16 36 56 76 96 116 [5,] 25 50 75 100 125 150 ? x*1:5 ? sweep(x,2,1:6,+) [,1] [,2] [,3] [,4] [,5] [,6] [1,] 2 8 14 20 26 32 [2,] 3 9 15 21 27 33 [3,] 4 10 16 22 28 34 [4,] 5 11 17 23 29 35 [5,] 6 12 18 24 30 36 Array和矩陣 /向量 /array之間的運(yùn)算 ? z=array(1:24,c(2,3,4))注意排列次序 z , , 1 [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 , , 2 [,1] [,2] [,3] [1,] 7 9 11 [2,] 8 10 12 , , 3 [,1] [,2] [,3] [1,] 13 15 17 [2,] 14 16 18 , , 4 [,1] [,2] [,3] [1,] 19 21 23 [2,] 20 22 24 Array和矩陣 /向量 /array之間的運(yùn)算 ? sweep(z,1,1:2,) , , 1 [,1] [,2] [,3] [1,] 0 2 4 [2,] 0 2 4 , , 2 [,1] [,2] [,3] [1,] 6 8 10 [2,] 6 8 10 , , 3 [,1] [,2] [,3] [1,] 12 14 16 [2,] 12 14 16 , , 4 [,1] [,2] [,3] [1,] 18 20 22 [2,] 18 20 22 Array和矩陣 /向量 /array之間的運(yùn)算 ? sweep(z,c(1,2),matrix(1:6,2,3),) , , 1 [,1] [,2] [,3] [1,] 0 0 0 [2,] 0 0 0 , , 2 [,1] [,2] [,3] [1,] 6 6 6 [2,] 6 6 6 , , 3 [,1] [,2] [,3] [1,] 12 12 12 [2,] 12 12 12 , , 4 [,1] [,2] [,3] [1,] 18 18 18 [2,] 18 18 18 外積 (產(chǎn)生矩陣或 array) ? outer(1:2,rep(1,2)) [,1] [,2] [1,] 1 1 [2,] 2 2 ? outer(1:2,matrix(rep(1,6),3,2)) , , 1 [,1] [,2] [,3] [1,] 1 1 1 [2,] 2 2 2 , , 2 [,1] [,2] [,3] [1,] 1 1 1 [2,] 2 2 2 List(set of objects) ? list可以是任何對(duì)象的集合 (包括 lists) ? z=list(1:3,Tom=c(1:2, a=list(R,letters[1:5]),w=hi!)) ? z[[1]]。 Array ? x=array(runif(20),c(4,5))。unique(x) 矩陣的轉(zhuǎn)置和逆矩陣 ? x=matrix(runif(9),3,3)。any(x0)。, |, ! ? x=rnorm(10) ? all(x0)。 第 1中大于 0并且 相應(yīng)于第 3列中小于或等于 1的元素 (“與 ” ) ? x[x[,2]0|x[,1].51,1] 第 1中小于 .51或者 相應(yīng)于第 2列中大于 0的元素 (“或 ” ) ? x[!x[,2].51,1]第一列中相應(yīng)于第 2列中 不小于 .51的元素 (“非 ” ) ? 邏輯運(yùn)算 :, , ==, =, =, !=。dim(x)行列數(shù)目 ? x=matrix(rnorm(24),4,6) ? x[c(2,1),]第 2和第 1行 ? x[,c(1,3)] 第 1和第 3列 ? x[2,1] 第 [2,1]元素 ? x[x[,1]0,1] 第 1列大于 0的元素 ? sum(x[,1]0) 第 1列大于 0的元素的個(gè)數(shù) ? sum(x[,1]=0) 第 1列不大于 0的元素的個(gè)數(shù) ? x[,c(1,3)] 沒(méi)有第 3列的 x. ? x[2,c(1,3)] 沒(méi)有第 2行 、 第 3列的 x. 矩陣 /向量的 (子集 ) ? x[x[,1]0amp。x [,1] [,2] [,3] [,4] [,5] [1,] 1 2 3 4 5 [2,] 6 7 8 9 10 [3,] 11 12 13 14 15 [4,] 16 17 18 19 20 一些簡(jiǎn)單函數(shù) ? max,min,length,mean,median, fivenum,quantile,unique,sd,var,range,rep,diff,sort,order,sum,cumsum,prod,cumprod,rev,print,sample,seq,exp,pi 矩陣的行和列 (子集 ) ? nrow(x)。z 比較 sample(1:100,10,rep=T) ? [1] 75 68 28 42 17 21 96 34 69 47 ? order(z) ? [1] 5 6 3 8 4 10 2 9 1 7 ? z[order(z)] ? [1] 17 21 28 34 42 47 68 69 75 96 ? sort(z) ? [1] 17 21 28 34 42 47 68 69 75 96 ? which(z==max(z))給出下標(biāo) Matrix ? x=matrix(runif(20),4,5) ? x [,1] [,2] [,3] [,4] [,5] [1,] [2,] [3,] [4,] ? x=matrix(1:20,4,5)。z ? [1] 1 2 3 4 5 NA 8 ? z=NULL ? z[c(1,3,5)]=1:3。x+z ? [1] 1 2 3 1 2 3 1 2 3 1 Warn
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1