> install.packages("mediation")
Warning in install.packages :
unable to access index for repository https://mirrors.tongji.edu.cn/CRAN/src/contrib:
cannot open URL 'https://mirrors.tongji.edu.cn/CRAN/src/contrib/PACKAGES'
Warning in install.packages :
unable to access index for repository https://mirrors.tongji.edu.cn/CRAN/src/contrib:
cannot open URL 'https://mirrors.tongji.edu.cn/CRAN/src/contrib/PACKAGES'
Warning in install.packages :
package ‘mediation’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
Warning in install.packages :
unable to access index for repository https://mirrors.tongji.edu.cn/CRAN/bin/windows/contrib/4.1:
cannot open URL 'https://mirrors.tongji.edu.cn/CRAN/bin/windows/contrib/4.1/PACKAGES'
1. wifi信号差,改手机热点
2. 改R studio设置: Tools -> Global Options -> Packages
多试几个
→成功:
> install.packages("mediation")
还安装相依关系‘lpSolve’
trying URL 'https://mirrors.bfsu.edu.cn/CRAN/bin/windows/contrib/4.1/lpSolve_5.6.15.zip'
Content type 'application/zip' length 698395 bytes (682 KB)
downloaded 682 KB
trying URL 'https://mirrors.bfsu.edu.cn/CRAN/bin/windows/contrib/4.1/mediation_4.5.0.zip'
Content type 'application/zip' length 1289659 bytes (1.2 MB)
downloaded 1.2 MB
package ‘lpSolve’ successfully unpacked and MD5 sums checked
package ‘mediation’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\19535\AppData\Local\Temp\Rtmp0AwzsY\downloaded_packages
> library(mediation)
载入需要的程辑包:Matrix
载入需要的程辑包:mvtnorm
载入需要的程辑包:sandwich
mediation: Causal Mediation Analysis
Version: 4.5.0
Warning messages:
1: 程辑包‘mediation’是用R版本4.1.2 来建造的
2: 程辑包‘Matrix’是用R版本4.1.1 来建造的