数据录入和操作
1.录入数据
> x = scan() #从键盘输入数据
1: 23
2: 12
3: 23
4:
Read 3 items
> x
[1] 23 12 23
>
> data = scan(file='test.data') #从文件中读取数据
Read 30 items
> data
[1] 65.0 45.0 27.6 70.0 45.0 30.7 70.0 48.0 31.8 69.0 46.0
[12] 32.6 66.0 50.0 31.0 67.0 46.0 31.3 68.0 47.0 37.0 72.0
[23] 43.0 33.6 66.0 47.0 33.1 68.0 48.0 34.2
>
> data.entry(data) #用电子表格界面来编辑数据 如下图
> var2
[1] 21 NA 213 NA NA NA NA NA 231
>
> x <- read.table(file='test.data')
> x
V1 V2 V3
1 65 45 27.6
2 70 45 30.7
3 70 48 31.8
4 69 46 32.6
5 66 50 31.0
6 67 46 31.3
7 68 47 37.0
8 72 43 33.6
9 66 47 33.1
10 68 48 34.2
>