第二课实验

> help dim
错误: 意外的符号在"help dim"里
> help(dim)
starting httpd help server ... done
> x=c(rep(c(1,2,3,4),c(4,3,2,1)))
> x
 [1] 1 1 1 1 2 2 2 3 3 4
> dim=c(4,4)
> dim
[1] 4 4
> array(1,dim)
     [,1] [,2] [,3] [,4]
[1,]    1    1    1    1
[2,]    1    1    1    1
[3,]    1    1    1    1
[4,]    1    1    1    1
> arry(1,4,4)
错误: 没有"arry"这个函数
> help(dim)
> h=array(2,dim)
> h
     [,1] [,2] [,3] [,4]
[1,]    2    2    2    2
[2,]    2    2    2    2
[3,]    2    2    2    2
[4,]    2    2    2    2
> dim(h)
[1] 4 4
> dim(h)错误于dim(h) > dim(h)错误于dim(h) > clear
错误: 找不到对象'clear'
> x1=round(runif(100,min=80,max=100))
> x2=round(rnorm(100,mean=80,sd=7))
> x3=round(rnorm(100,mean=83,sd=18))
> x3[which(x3>100)]=100
> x=data.frame(x1,x2,x3)
> x
     x1 x2  x3
1    96 82  85
2    96 78  52
3    89 69  81
4    81 83 100
5    89 62  68
6    94 72  93
7    94 84  80
8    82 77  77
9    91 90 100
10   90 86  88
11   94 77  88
12   89 74  75
13   90 87 100
14   82 84  88
15   89 79  55
16   81 84  73
17   88 66  84
18   90 75  61
19   88 82  73
20   83 75  85
21   95 78 100
22   89 75  88
23   80 75  61
24   96 83 100
25   81 74  86
26   80 76  74
27   88 78  70
28   93 90  67
29   91 73  79
30   90 86  69
31   85 82  80
32   89 69  85
33   81 77  58
34   91 76  81
35   82 92 100
36   85 75  70
37   83 69  78
38   86 85  99
39   95 81  64
40   96 87  89
41   92 88  57
42   94 74  82
43   98 84  88
44   88 78  92
45   85 73  49
46   81 75  86
47   85 74  69
48   94 80  90
49   94 88  70
50   82 66 100
51  100 76  63
52   93 79 100
53   85 82  91
54   95 78  71
55   97 65  71
56   80 89  98
57   91 84  65
58   82 89  94
59   92 81  48
60   91 80  90
61   83 89  96
62   90 67  78
63   98 77  87
64   93 90 100
65   97 66  93
66   82 70  61
67   81 77  96
68   96 72 100
69   99 84  99
70   84 79  86
71   99 83  70
72   95 85 100
73   96 91  88
74   94 71  98
75   99 79  85
76   89 76  78
77   89 80  62
78   88 77  87
79   89 92  66
80   92 81  84
81   97 86 100
82   99 91  85
83   97 66  92
84   99 75  47
85   86 77 100
86   98 93  55
87   92 69  35
88   81 85 100
89   93 80 100
90   87 86 100
91   97 74  82
92   85 78  59
93   96 73 100
94   87 81  79
95   90 86  83
96   86 80  96
97   86 75  82
98   92 83  68
99   94 80  65
100  97 73  43
> white.table(x,file="d:\\mark.txt",col.names=F,row.names=F,sep=" ")
错误: 没有"white.table"这个函数
> write.table(x,file="d:\\mark.txt",col.names=F,row.names=F,sep=" ")
> apply(x,2,max)
 x1  x2  x3
100  93 100
> apply(x,1,max)
  [1]  96  96  89 100  89  94  94  82 100  90  94  89 100  88  89  84  88  90  88  85 100  89  80 100  86  80  88  93  91  90  85  89  81  91
 [35] 100  85  83  99  95  96  92  94  98  92  85  86  85  94  94 100 100 100  91  95  97  98  91  94  92  91  96  90  98 100  97  82  96 100
 [69]  99  86  99 100  96  98  99  89  89  88  92  92 100  99  97  99 100  98  92 100 100 100  97  85 100  87  90  96  86  92  94  97
> apply(x,2,min)
x1 x2 x3
80 62 35
> apply(x,1,sum)
  [1] 263 226 239 264 219 259 258 236 281 264 259 238 277 254 223 238 238 226 243 243 273 252 216 279 241 230 236 250 243 245 247 243 216 248
 [35] 274 230 230 270 240 272 237 250 270 258 207 242 228 264 252 248 239 272 258 244 233 267 240 265 221 261 268 235 262 283 256 213 254 268
 [69] 282 249 252 280 275 263 263 243 231 252 247 257 283 275 255 221 263 246 196 266 273 273 253 222 269 247 259 262 243 243 239 213
> which.max(apply(x,1,sum))
[1] 64
> hist(x$x1)
> hist(x)
错误于hist.default(x) : 'x'必需为数值
> hist(x$x2)
> hist(x$x3)
> hist(x$x2)
>
> plot(x1,x2)
> plot(x3,x2)
> table(x$x1)
 80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98
  3   7   6   3   1   6   4   2   5   9   6   5   5   4   8   4   7   6   3
 99 100
  5   1
> barplot(x$x1)
> hist(x$x1)
> barplot(x$x1)
> barplot(table(x$x1))
> pie(table(x$x1))
> table 列联函数
错误: 意外的符号在"table 列联函数"里
> boxplot(x$x1,x$x2,x$x3)
> boxplot(x[1:3],col=c("red","green","blue"),notch=T)
> boxplot(x[1:3],col=c("red","green","blue"),horizontal=T)
> stars(x[c(1,2,3)])
> stars(x[c("x1","x2","x3")])
> stars(x[c(1,2,3)])
> stars(x[c("x1","x2","x4")])
错误于`[.data.frame`(x, c("x1", "x2", "x4")) :
  undefined columns selected
> stars(x[c("x1","x2","x3")])
>
> stars(x[c("x1","x2","x3")],full=T,draw.segment=T)
> stars(x[c("x1","x2","x3")],full=F,draw.segment=T)
> star(x[c("x1","x2","x3")])
错误: 没有"star"这个函数
> faces(x[c("x1","x2","x3")])
错误: 没有"faces"这个函数
> local({pkg + if(nchar(pkg)) library(pkg, character.only=TRUE)})
> local({pkg + if(nchar(pkg)) library(pkg, character.only=TRUE)})
> utils:::menuInstallPkgs()
--- 在此連線階段时请选用CRAN的鏡子 ---
错误于contrib.url(repos, type) : 试试在不设定镜像的情况下用CRAN
> utils:::menuInstallPkgs()
--- 在此連線階段时请选用CRAN的鏡子 ---
错误于install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) :
  没有设定程序包
> utils:::menuInstallPkgs()
错误于install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) :
  没有设定程序包
> setRepositories()
> local({pkg + if(nchar(pkg)) library(pkg, character.only=TRUE)})
> setRepositories()
> utils:::menuInstallPkgs()
错误于install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) :
  没有设定程序包
> utils:::menuInstallPkgs()
试开URL’http://cran.dataguru.cn/bin/windows/contrib/2.15/TeachingDemos_2.8.zip'
Content type 'application/zip' length 604092 bytes (589 Kb)
打开了URL
downloaded 589 Kb
程序包‘TeachingDemos’打开成功,MD5和检查也通过
下载的二进制程序包在
        C:\Users\Administrator\AppData\Local\Temp\RtmpayRSke\downloaded_packages里
> library(TeachingDemos)
> faces2(x)
> stem(x$x1)
  The decimal point is at the |
   80 | 0000000000
   82 | 000000000
   84 | 0000000
   86 | 000000
   88 | 00000000000000
   90 | 00000000000
   92 | 000000000
   94 | 000000000000
   96 | 0000000000000
   98 | 00000000
  100 | 0
> qqnorm(x$x1)
> qqline(x$x1)
> qqnorm(x$x2)
> qqline(x$x2)
> qqnorm(x$x3)
> qqline(x$x3)
> plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",ylim=(20,100),xaxs="i",yaxs="i",col="red",pch=19)
错误: 意外的','在"plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",ylim=(20,"里
> plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",xlim=(0,100),ylim=(20,100),xaxs="i",yaxs="i",col="red",pch=19)
错误: 意外的','在"plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",xlim=(0,"里
> plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",xlim=(0,100),ylim=(20,100),xaxs="i",yaxs="i",col="red",pch=19)
错误: 意外的','在"plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",xlim=(0,"里
> plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",xlim=(0,100),ylim=(20,100),xaxs="i",yaxs="i",col="red",pch=19)
错误: 意外的','在"plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",xlim=(0,"里
> plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",xlim=c(0,100),ylim=c(20,100),xaxs="i",yaxs="i",col="red",pch=19)
> plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",xlim=c(0,100),ylim=c(20,100),xaxs="i",yaxs="i",col="red",pch=19)
> plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",xlim=c(60,100),ylim=c(60,100),xaxs="i",yaxs="i",col="red",pch=19)
> plot(x$x1,x$x2,type="l")
> plot(x$x1,x$x2,main="Main",xlab="x11",ylab="x22",xlim=c(60,100),ylim=c(60,100),xaxs="i",yaxs="i",col="red",pch=19)
>
>
>
> plot(density(rnorm(1000)))
> plot(density(rnorm(1000)))
> plot(density(rnorm(1000)))
> plot(density(rnorm(1000)))
> plot(density(rnorm(1000)))
> plot(rnorm(100))
> plot(rnorm(1000))
> plot(density(rnorm(1000)))
> plot(rnorm(1000))
> heatmap(x)
错误于heatmap(x) : 'x'必需为数值矩阵
> heatmap(maxtrx(x))
错误于heatmap(maxtrx(x)) : 没有"maxtrx"这个函数
> heatmap(matrix(x))
错误于heatmap(matrix(x)) : 'x'必需为数值矩阵
> x
     x1 x2  x3
1    96 82  85
2    96 78  52
3    89 69  81
4    81 83 100
5    89 62  68
6    94 72  93
7    94 84  80
8    82 77  77
9    91 90 100
10   90 86  88
11   94 77  88
12   89 74  75
13   90 87 100
14   82 84  88
15   89 79  55
16   81 84  73
17   88 66  84
18   90 75  61
19   88 82  73
20   83 75  85
21   95 78 100
22   89 75  88
23   80 75  61
24   96 83 100
25   81 74  86
26   80 76  74
27   88 78  70
28   93 90  67
29   91 73  79
30   90 86  69
31   85 82  80
32   89 69  85
33   81 77  58
34   91 76  81
35   82 92 100
36   85 75  70
37   83 69  78
38   86 85  99
39   95 81  64
40   96 87  89
41   92 88  57
42   94 74  82
43   98 84  88
44   88 78  92
45   85 73  49
46   81 75  86
47   85 74  69
48   94 80  90
49   94 88  70
50   82 66 100
51  100 76  63
52   93 79 100
53   85 82  91
54   95 78  71
55   97 65  71
56   80 89  98
57   91 84  65
58   82 89  94
59   92 81  48
60   91 80  90
61   83 89  96
62   90 67  78
63   98 77  87
64   93 90 100
65   97 66  93
66   82 70  61
67   81 77  96
68   96 72 100
69   99 84  99
70   84 79  86
71   99 83  70
72   95 85 100
73   96 91  88
74   94 71  98
75   99 79  85
76   89 76  78
77   89 80  62
78   88 77  87
79   89 92  66
80   92 81  84
81   97 86 100
82   99 91  85
83   97 66  92
84   99 75  47
85   86 77 100
86   98 93  55
87   92 69  35
88   81 85 100
89   93 80 100
90   87 86 100
91   97 74  82
92   85 78  59
93   96 73 100
94   87 81  79
95   90 86  83
96   86 80  96
97   86 75  82
98   92 83  68
99   94 80  65
100  97 73  43
> heatmap(matrix(x))
错误于heatmap(matrix(x)) : 'x'必需为数值矩阵
> mod(x)
错误: 没有"mod"这个函数
> mode(x)
[1] "list"
> heatmap(matrix(mtcars))
错误于heatmap(matrix(mtcars)) : 'x'必需为数值矩阵
> heatmap(matrix(iris))
错误于heatmap(matrix(iris)) : 'x'必需为数值矩阵
> sunflowerplot(iris[,3:4],col="gold",seg.col="green")
>
>
>
> pairs(iris[,1:4])
> plot(iris[,1:4])
> pairs(iris[,1:4])
> plot(iris[,1:4])
> pa
错误: 找不到对象'pa'
> help(par)
> par(mfrow=c(3,1))
> plot(x1,x2)
> plot(x3,x2)
> plot(x1,x3)
> plot(x3,x2)
> dev.cur()
windows
      2
> dev.new()
> dev.list()
windows windows
      2       3
> plot(x3,x2)
> dev.list()
windows windows
      2       3
> dev.cur()
windows
      3
> dev.next()
windows
      2
> 图形窗切换
错误: 找不到对象'图形窗切换'
> utils:::menuInstallPkgs()
试开URL’http://cran.dataguru.cn/bin/windows/contrib/2.15/scatterplot3d_0.3-33.zip'
Content type 'application/zip' length 606842 bytes (592 Kb)
打开了URL
downloaded 592 Kb
程序包‘scatterplot3d’打开成功,MD5和检查也通过
下载的二进制程序包在
        C:\Users\Administrator\AppData\Local\Temp\RtmpayRSke\downloaded_packages里
> library(scatterplot3d)
> scatterplot3d(x)
>  source("a.r")
错误于file(filename, "r", encoding = encoding) : 无法打开链结
此外: 警告信息:
In file(filename, "r", encoding = encoding) :
  无法打开文件'a.r': No such file or directory
> 画地图
错误: 找不到对象'画地图'
> map
错误: 找不到对象'map'

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27573546/viewspace-747154/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/27573546/viewspace-747154/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值