多元统计与R语言第一次上机作业

2.

1
2
3
c(1,2,3)
s<-c
print(s)

3.1

}
1
((-27)*12)/21

3.2

1
sqrt(10)

3.3

1
log(10)

3.4

1
log10(2+3*pi)

3.5

1
exp(2.7689)

3.6

1
(25-5)^3

3.7

1
cos(pi)

3.8.1

1
prod(2:3)

3.8.2

1
10*9*8*7*6*5*4

3.8.3

1
(10*9*8*7*6*5*4)/(40*39*38*37*36)

3.9.1

1
choose(5,2)

3.9.2

1
choose(7,3)

4.rep

1
2
a=c(1,2)
rep(a,2)

4.seq

1
seq(from=1,to=10,by=2)

4.matrix

1
2
data=c(1,2,3,4,5,6,7,8)
matrix(data,nrow=4,ncol=2,byrow=T)

5.1

1
dnorm(1)

5.2

1
qnorm(0.95)

5.3

1
rpois(100,5)

5.4

1
rnorm(100,60,10)

6.

1
2
x=c(rnorm(100,0,1))
print(x)

1
2
3
4
5
6
7
8
print(sum(x))
print(mean(x))
print(var(x))
print(sd(x))
print(min(x))
print(max(x))
print(median(x))
print(summary(x))

7.

1
2
x=seq(1,10,1)
plot(x,exp(x))

7.2

1
2
3
x=runif(100,1,10)
print(x)
hist(x)

8.

1
library(MASS)

9.

1
2
3
4
5
6
ID=c('01','02','03')
class=c(1,2,3)
body_long=c(188,189,190)
weight=c(66,67,65)
df=data.frame(ID,class,body_long,weight)
print(df)

10.

1
2
print(df[,2])
print(df[2,2])

11.

1
2
data0=read.csv('path+1.csv')
data1=read.table('path+1.txt',header=F)

凡希 wechat
喜欢所以热爱,坚持干货分享,欢迎订阅我的微信公众号
呐,请我吃辣条