1.getwd():list the current working directory. (即获得当前工作路径)
2.setwd("mydirectory"):change the current working directory to mydirectory.(改变当前工作路径为mydirectory)
3.dir.create("mydirectory"):创建一级路径。
4.ls():list the objects in the current working space.(列出当前工作区的所有objects)
注意:
(1)如果setwd("mydirectory")中的mydirectory与getwd()函数求得的路径不一样,则会报错。
(2)解决(1)中问题的办法:使用dir.create("mydirectory")函数先创建一级路径。
注意:路径mydirectory中只能新创建最后一级路径;否则 ,创建路径无效。
例如:我在H盘中创建了文件夹myprojects,即已存在的路径为"H:/myprojects" ,
再创建路径"H:/myprojects/Listing1.1",即只创建了一级路径,是可以的;
但若创建路径"H:/myproject/Listing1.1",会报错,因为myproject和Listing1.1这两个文件夹都是新创建,即创建了两级路径。
Listing1.1
5.c(object1,object2...objectN):combine its arguments into a vector or list.
6.mean(object):calculate the object's mean.(求平均值)
sd(object):calculate the object's standard deviaton.(求标准差)
cor(object1,object2):calculate the object1 and object2's correlation.(求相关系数)
plot(object1,object2):draw the object1 and object2' scatter plot in figure.
7.savehistory("mydirectorys"):save the commands history to myfile(default=.Rhistory).(保存命令行记录)
save.image("mydirectorys"):save the workspace to myfile(default=.RData). (保存当前工作区)
8.loadhistory("mydirectory"):reload a command's history(default=.Rhistory).
load("mydirectory"):load a workspace into the current session(default=.RData).