Can't Load statnet in R on Windows 10 - r

I have run
install.packages('statnet')
library('statnet')
Result:
Loading required package: tergm
Loading required package: ergm
Error: package or namespace load failed for ‘ergm’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘statnet.common’
Error: package ‘ergm’ could not be loaded
In addition: Warning messages:
1: package ‘statnet’ was built under R version 3.4.4
2: package ‘tergm’ was built under R version 3.4.4
Error: package ‘ergm’ could not be loaded
5.
stop(gettextf("package %s could not be loaded", sQuote(pkg)),
call. = FALSE, domain = NA)
4.
.getRequiredPackages2(pkgInfo, quietly = quietly)
3.
library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc,
quietly = quietly)
2.
.getRequiredPackages2(pkgInfo, quietly = quietly)
1.
library(statnet)
Next I tried
install.packages('ergm') # Worked with warning: dependency ‘statnet.common’ is not available
But library(statnet) still does not work, and library(ergm) has a similar error message.
Also tried install.packages(statnet.common) but also get
package ‘statnet.common’ is not available
I'm running RStudio Version 1.1.419, with R version 3.4.3 on Windows 10
Any ideas how to load statnet in R?

Updating my version of R to 3.5.3 solved my problem.

Related

Error: there is no package called ‘vctrs’

When I try to run these lines, I keep getting the issue below- any way to resolve this?? Thanks!
pkgs<-c('lmerTest', 'ggplot2')
suppressMessages(lapply(pkgs, require, character.only = TRUE))
require(lme4)
library(lmerTest)
require(interactions)
library(ggplot2)
require(apaTables)
library(apaTables)
Error: package or namespace load failed for ‘lmerTest’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘vctrs’
Try to install vctrs from github and this helped in my case.
install.packages("vctrs", repos = "https://packagemanager.rstudio.com/cran/latest")

How do I get rid of the package e1071 installation error?

I am trying to run the confusionMatrix function but it shows this error and when I try to install the package it shows the error in bold below it.
Error: package e1071 is required
Traceback:
confusionMatrix(factor(test_data$area, levels = 1:100), factor(test_data$pred_rf,
. levels = 1:100))
confusionMatrix.default(factor(test_data$area, levels = 1:100),
. factor(test_data$pred_rf, levels = 1:100))
getFromNamespace("confusionMatrix.table", "caret")(classTable,
. positive, prevalence = prevalence, mode = mode)
requireNamespaceQuietStop("e1071")
stop(paste("package", package, "is required"), call. = FALSE)
also installing the dependency ‘proxy’
Warning message in install.packages("e1071"):
“installation of package ‘proxy’ had non-zero exit status”Warning message in install.packages("e1071"):
“installation of package ‘e1071’ had non-zero exit status”Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
How do I solve this?

Installing caret package in R

When I tried to load package of "caret" for my logistic regression model in R, the error message says "package or namespace load failed for ‘caret’.....". Is it an issue of my R version? I have 1.1.456 version.
install.packages("caret")
library(caret)
crossValSettings <- trainControl(method = "repeatedcv", number = 10,savePredictions = TRUE)

R error - cannot find function in installed package

I am trying to run a oneway whelch Anova in R using the package userfriendlyscience. Below are my steps:
install the package using the following command
install.packages("userfriendlyscience")
direct R to the package library using library(userfriendlyscience).
run the oneway test using the command:
one.way <- oneway(data$group, y = data$Volume, posthoc = 'games-howell')
However, I get the following errors:
When I direct R to the package:
Error: package or namespace load failed for ‘userfriendlyscience’ in
loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =
vI[[j]]): there is no package called ‘psych’ In addition: Warning
message: package ‘userfriendlyscience’ was built under R version 3.5.3
when I run the oneway test:
Error in oneway(data$group, y = data$Volume, posthoc = "games-howell")
: could not find function "oneway"
I am using R version 3.5.2 - could this be the problem? and if so is there a work around or should I download a newer version of R?
Thanks

After I installed car package, I can not load Salaries data set

> r#quire(car) # Salaries 데이타을 사용을 위해
필요한 패키지를 로딩중입니다: car
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
네임스페이스 ‘pbkrtest’ 0.4-2는 로드되었으나 >= 0.4.4가 필요합니다
In addition: Warning message:
패키지 ‘car’는 R 버전 3.2.5에서 작성되었습니다
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
네임스페이스 ‘pbkrtest’ 0.4-2는 로드되었으나 >= 0.4.4가 필요합니다
In addition: Warning message:
패키지 ‘car’는 R 버전 3.2.5에서 작성되었습니다
Error: package or namespace load failed for ‘car’
> str(Salaries)
Error in str(Salaries) : object 'Salaries' not found
A car package is the default one it already installed when I install r. I tried to download and include it. But It still got the error that it can not find the Salaries data set that included in car package. What is the problem? Sorry for the Korean message. If you let me know to change message in English, I will retry and reupload the message. Below is my console
UPDATE
I updated this error message in English and tried running the comment's one. But still it is not working.
> install.packages("car", dependencies=TRUE)
Warning in install.packages :
dependency ‘pbkrtest’ is not available
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/car_2.1-3.zip'
Content type 'application/zip' length 1447199 bytes (1.4 MB)
downloaded 1.4 MB
package ‘car’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Windows\Temp\Rtmpgr6B80\downloaded_packages
> library(car)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace ‘pbkrtest’ 0.4-2 is being loaded, but >= 0.4.4 is required
In addition: Warning message:
package ‘car’ was built under R version 3.2.5
Error: package or namespace load failed for ‘car’
> str(Salaries)
Error in str(Salaries) : object 'Salaries' not found
It solved with update r version up to 3.3.2. pbkrtest needs r version to be more than 3.3.2 (newest version). I updated r and reinstall pbkrtest and then car package.
Salaries data set is currently available under [carData package], I solved as the following
install.packages("carData")
data("Salaries", package="carData")
sample_n(Salaries,3)
rank discipline yrs.since.phd yrs.service sex salary
1 Prof B 26 19 Male 193000
2 AssocProf A 13 8 Male 78182
3 AsstProf B 4 3 Male 91000

Resources