Installing caret package in R - 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)

Related

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

doparallel package in caret train model under linux

I have a problem when I run the train function in caret with parallel processing, for example, when I run a simple R code like:
library(doParallel); cl <- makeCluster(4);
registerDoParallel(cl)
require(caret);data(BloodBrain);
set.seed(123)
fit1 <- train(bbbDescr, logBBB, "knn"); fit1
stopCluster(cl); registerDoSEQ();
I get this error message
Error in e$fun(obj, substitute(ex), parent.frame(), e$data) :
worker initialization failed: there is no package called ‘caret’
I installed last vesion of caret under R 3.3.0.
I installed the R version and caret version on windows, it is work.
any one have any suggestion about this??

Running GAM function from mgcv package with R 3.2.2

I have recently run into a problem running a GAM model from a previously working code. I believe it is related to an updated R-Version and an updated Version of the mgcv package. It would be great to know if anyone has the same problem or has a solution to it.
I am currently running R version 3.2.2 (2015-08-14) -- "Fire Safety"
on Windows. I am using the mgcv Package 1.8-7. Below is an example code that re-produces the error message, when run on my computer.
###Load package
library(mgcv)
This is mgcv 1.8-7.
###Simulate some example data
set.seed(2) ## simulate some data...
dat <- gamSim(1,n=400,dist="normal",scale=2)
###Run normal model
b <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat, family=gaussian())
This works.
###change the smoothness selection method to REML
b0 <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat,method="REML")
Gives the following error message:
Error in .C(C_gdi1, X = as.double(x[good, ]), E = as.double(Sr), Eb = as.double(Eb), : Incorrect number of arguments (48), expecting 47 for 'gdi1'
Thanks for your help!
I have re-installed R and the mgcv package and it seems as if this has resolved the issue.

R rms package error when using rcs()

Been looking into Harrell's rms package for R and I am getting an error whenever I try to use the spline function rcs() inside a formula. This happens with all datasets. Is there some R setting I am missing?
library(rms)
df = read.csv("http://www.ats.ucla.edu/stat/data/binary.csv")
m = lrm(admit~ rcs(gre), df)
Error in rcspline.eval(x, nk = nknots, inclx = TRUE, pc = pc, fractied = fractied) :
unused argument (fractied = fractied)
What is "fractied"? I haven't been able to find a clear explanation.
I'm using Windows 7, R version 3.1.0, rms version 4.2.0

rpart package issue in R 3.0.1 version

i am newbie to R
i am using R 3.0.1 version,
I have installed rpart package using
install.packages("rpart")
selected USA(CA 1) in the pop up box and it is installed successfully
> p_data = read.csv(file="/home/sudeep/Desktop/mysql.tsv",sep="\t",dec=".",header=TRUE)
> dtree <- rpart(paid ~ .,data = p_data, method="class")
Error: could not find function "rpart"
so what is wrong with me??
You don't actually need to install rpart manually; it comes with the base R distribution. However, you do need to load it into your R session with a call to library:
library(rpart)
rpart(paid ~ ., data=....)

Resources