1、查看当前工作空间
> getwd() [1] "C:/Users/P0079482.HHDOMAIN/Documents" >
2、查看内存中有哪些对象
> ls() [1] "a" "a1" "b" "bank" "bank_full" "dat" [7] "m1" "tab" "w" "x" "x1" "x2" >
3、把指定对象从内存中删除
> rm(‘a‘) > ls() [1] "a1" "b" "bank" "bank_full" "dat" "m1" [7] "tab" "w" "x" "x1" "x2" >
4、查看函数帮助
> help(matrix) >
5、创建向量和矩阵
> x1=c(2,4,6,8,0) > x2=c(1,3,5,7,9)查看向量的长度 > length(x1) [1] 5查看向量的类型 > mode(x1) [1] "numeric" >
6、按行将向量排列成矩阵
> rbind(x1,x2) [,1] [,2] [,3] [,4] [,5] x1 2 4 6 8 0 x2 1 3 5 7 9
时间: 2024-10-28 15:35:16