# store the current directory
initial.dir<-getwd()
# change to the new directory
setwd("/home/jim/psych/risk/adol")
# load the necessary libraries
library(nlme)
# set the output file
sink("adolrisk03.out")
# load the dataset
...
# close the output file
sink()
# unload the libraries
detach("package:nlme")
# change back to the original directory
setwd(initial.dir)
参考:
ftp://cran.r-project.org/pub/R/doc/contrib/Lemon-kickstart/kr_scrpt.html
本文演示了使用R语言进行心理学研究中的风险因素分析的过程。包括工作目录的切换、必要库的加载、数据集的读取及输出文件的设置等关键步骤。

被折叠的 条评论
为什么被折叠?



