解決R語言安裝時出現輯程包不存在的問題

【解決方案】

1.使用命令單獨安裝caret,安裝的時間很長。

install.packages("caret", dependencies = c("Depends", "Suggests"))

需要安裝依賴的包全部安裝之後,就可以瞭。

依賴包如下:

dependencies ‘doMC’, ‘rpvm’, ‘Rcompression’, ‘RMySQL’, ‘globaltest’, ‘OpenMx’, ‘pryr’, ‘gpclib’, ‘marray’, ‘affy’, ‘Biobase’, ‘RSVGTipsDevice’, ‘rhdf5′, ‘graph’, ‘ncdf4′, ‘Rgraphviz’ are not available
also installing the dependencies ‘latticeExtra’, ‘slam’, ‘geoRglm’, ‘vioplot’, ‘ncdf’, ‘rasterVis’, ‘Rglpk’, ‘Rsymphony’, ‘BRugs’, ‘rjags’, ‘optextras’, ‘svGUI’, ‘misc3d’, ‘geoR’, ‘denstrip’, ‘raster’, ‘polyclip’, ‘relations’, ‘igraphdata’, ‘R2WinBUGS’, ‘SuppDists’, ‘numDeriv’, ‘gamm4′, ‘betareg’, ‘maxlike’, ‘R2jags’, ‘R2OpenBUGS’, ‘BB’, ‘ucminf’, ‘Rcgmin’, ‘Rvmmin’, ‘minqa’, ‘setRNG’, ‘dfoptim’, ‘svUnit’, ‘mapdata’, ‘sm’, ‘rpanel’, ‘tkrplot’, ‘RandomFields’, ‘deldir’, ‘clue’, ‘igraph’, ‘emdbook’, ‘MuMIn’, ‘AICcmodavg’, ‘optimx’, ‘gmp’, ‘rgdal’, ‘gstat’, ‘spatstat’, ‘PBSmapping’, ‘flexclust’, ‘isa2′, ‘bbmle’, ‘Rmpfr’, ‘partitions’, ‘polynom’, ‘rugarch’, ‘mvnormtest’, ‘pkgKitten’, ‘combinat’, ‘RItools’, ‘rgenoud’, ‘rbounds’, ‘inline’, ‘forward’, ‘RDCOMClient’, ‘mapproj’, ‘linprog’, ‘scalreg’, ‘sp’, ‘maptools’, ‘biclust’, ‘MplusAutomation’, ‘GPArotation’, ‘mnormt’, ‘copula’, ‘png’, ‘RcppArmadillo’, ‘hexbin’, ‘CompQuadForm’, ‘cem’, ‘optmatch’, ‘Matching’, ‘WhatIf’, ‘BMA’, ‘DescTools’, ‘maps’, ‘gridBase’, ‘hdi’, ‘spam’, ‘shapefiles’, ‘spdep’, ‘rgeos’, ‘seriation’, ‘lavaan.survey’, ‘semPlot’, ‘semTools’, ‘simsem’, ‘Cairo’, ‘markdown’, ‘Amelia’, ‘survey’, ‘MatchIt’, ‘pcaPP’, ‘relimp’, ‘Ecfun’, ‘gdata’, ‘gnm’, ‘ca’, ‘gmodels’, ‘Fahrmeir’, ‘Sleuth2′, ‘stabs’, ‘fields’, ‘BayesX’, ‘gbm’, ‘snowfall’, ‘corrplot’, ‘corpcor’, ‘gsl’, ‘lavaan’, ‘arm’, ‘DBI’, ‘RSQLite’, ‘RODBC’, ‘shiny’, ‘bitops’, ‘AGD’, ‘mitools’, ‘pan’, ‘Zelig’, ‘rrcov’, ‘lokern’, ‘qvcalc’, ‘glmmML’, ‘Ecdat’, ‘geepack’, ‘ordinal’, ‘vcdExtra’, ‘glmnet’, ‘mboost’, ‘lqa’, ‘lpSolve’, ‘GAMBoost’, ‘penalized’, ‘TTR’, ‘gamlss.data’, ‘candisc’, ‘corrgram’, ‘FRB’, ‘animation’, ‘miscTools’, ‘VGAMdata’, ‘polycor’, ‘MBESS’, ‘mi’, ‘quadprog’, ‘biglm’, ‘tripack’, ‘logspline’, ‘nor1mix’, ‘MatrixModels’, ‘Formula’, ‘testit’, ‘rmarkdown’, ‘XML’, ‘RCurl’, ‘rms’, ‘mice’, ‘tables’, ‘robust’, ‘fit.models’, ‘MPV’, ‘sfsmisc’, ‘catdata’, ‘quantmod’, ‘gamlss’, ‘gamlss.dist’, ‘gplots’, ‘fBasics’, ‘poLCA’, ‘heplots’, ‘maxLik’, ‘MCMCpack’, ‘VGAM’, ‘sem’, ‘locfit’, ‘expm’, ‘diptest’, ‘mgcv’, ‘mix’, ‘bdsmatrix’, ‘kinship2′, ‘leaps’, ‘oz’, ‘quantreg’, ‘knitr’, ‘Hmisc’, ‘date’, ‘robustbase’, ‘PerformanceAnalytics’, ‘fTrading’, ‘reshape’, ‘effects’, ‘ineq’, ‘mlogit’, ‘np’, ‘plm’, ‘pscl’, ‘ROCR’, ‘sampleSelection’, ‘systemfit’, ‘rgl’, ‘truncreg’, ‘urca’, ‘TSA’, ‘ape’, ‘flexmix’, ‘gee’, ‘mclust’, ‘rmeta’, ‘coxme’, ‘SimComp’, ‘ISwR’, ‘rlecuyer’, ‘rsprng’, ‘nws’, ‘coda’, ‘chron’, ‘DAAG’, ‘fts’, ‘its’, ‘mondate’, ‘timeDate’, ‘timeSeries’, ‘tis’, ‘tseries’, ‘xts’, ‘lmtest’, ‘AER’, ‘dynlm’, ‘HSAUR’, ‘coin’, ‘multcomp’, ‘snow’, ‘RUnit’, ‘gclus’, ‘SparseM’, ‘xtable’, ‘plotmo’, ‘plotrix’, ‘akima’, ‘mvtnorm’, ‘TH.data’, ‘scatterplot3d’, ‘som’, ‘zoo’, ‘sandwich’, ‘strucchange’, ‘modeltools’, ‘vcd’, ‘Rmpi’, ‘microbenchmark’, ‘logcondens’, ‘doSNOW’, ‘cba’, ‘testthat’, ‘e1071′, ‘earth’, ‘fastICA’, ‘gam’, ‘ipred’, ‘kernlab’, ‘klaR’, ‘ellipse’, ‘mda’, ‘party’, ‘pls’, ‘pROC’, ‘proxy’, ‘randomForest’, ‘RANN’, ‘spls’

2.載入需要的程輯包:caret

> library(adabag)

這是我在網上找的,自己試瞭一下,所以記下來。

補充:R3.4.1加載ggplot2包失敗的解決辦法

這兩天在學R語言,版本是R3.4.1-x64,平臺Windows11,在RStudio使用install.packages(“ggplot2”)及library(ggplot2)總是不成功,顯示沒有這個文檔,很多warning,

先百度得出在RGUI中使用菜單程序包,選擇安裝程序包,選擇ggpolt2結果顯示warning:無法從一個臨時文件夾轉移至另一個文件夾(我安裝RStudio選擇的文件夾裡的library),後來反復更新程序包、加載程序包,都不行還弄出瞭non-zero退出的錯誤。

終於在百度終於得出瞭幾點,(原諒我忘瞭這個解決辦法的地址)有人說是鏡像問題,有人是版本不對重新下個,

下面是我的解決過程:

1.選擇CRAN鏡像,選擇RGUI菜單欄程序包->選擇CRAN鏡像->最下面的other morrors->china(xiamen)。如果不選擇other morrors,就隻能選擇china(lanzhou),要不然好幾個中國CRAN鏡像,北京、合肥,我選瞭廈門,百度的那個帖子是廈門,其他的我沒試。

2.選擇安裝程序包->ggplot2,安裝時就能看見URL是cran/xmen,在RStudio中用install.packages(…)的URL是cran.rstudio,有點不一樣。

3.我的安裝出現瞭”plyr”安裝打開成功,但是無法從臨時文件A復制到另一個文件B的問題。如果不解決這個問題是安裝不成功的。所以我把B中的那個文件夾刪瞭,因為安裝好幾次不成功,我的自己設置的R的文件夾中十幾個”filexxxxxxxx”這種文件夾,我都刪除瞭,然後是退出RGUI,重啟。我是重啟電腦瞭,不知道是不是隻要重啟RGUI行不行。

4.重新選擇廈門鏡像,安裝程序包,這次成功瞭,

5.選擇加載程序包,也成功瞭。

6.打開RStudio,library(ggplot2)。

大功告成,終於解決這個問題瞭,後面寫代碼還出現瞭“不存在叫‘stringi’這個名字的程輯包”,這種問題,那就在RStudio中“

install.packages(“stringi”

”就可以瞭。

以上為個人經驗,希望能給大傢一個參考,也希望大傢多多支持WalkonNet。如有錯誤或未考慮完全的地方,望不吝賜教。