[英]Error in R that concerns loading of gsl package
this might be a very particular question, but I have this function (see below) which I created and every time I try to run it with normal =FALSE aka using the else statement I get the following error: Loading required namespace: gsl Failed with error: 'there is no package called 'gsl'' I do not get the error if normal = TRUE.这可能是一个非常特殊的问题,但我有这个 function(见下文),我创建了它,每次我尝试使用正常 =FALSE aka 使用 else 语句运行它时,我都会收到以下错误:Loading required namespace: gsl Failed with错误:'没有 package 称为'gsl'' 如果 normal = TRUE,我不会收到错误消息。 I tried to install the gsl package but was not able to do it.
我尝试安装 gsl package 但无法安装。 Does one of you know why the error term pops up in the first place?
你们当中有人知道为什么会首先出现错误术语吗? Thanks for your help!
谢谢你的帮助!
if(normal==TRUE){
moments1 <- c(mean=0, variance=var1, skewness=0, kurtosis=3.0)
moments2 <- c(mean=0+(-es*(sqrt(((sample1-1) *(var1)+(sample2-1)*(var2))/(sample1+sample2-2)))), variance=var2, skewness=0, kurtosis=3.0)
} else{
moments1 <- c(mean=0, variance=var1, skewness=0.5, kurtosis=5.0)
moments2 <- c(mean=0+(-es*(sqrt(((sample1-1) *(var1)+(sample2-1)*(var2))/(sample1+sample2-2)))), variance=var2, skewness=0.5, kurtosis=5.0)
}
gen1 <- rpearson(n=sample1, moments=moments1)
gen2 <- rpearson(n=sample2, moments=moments2)
Y <- c(gen1, gen2)
group <- as.factor(c(rep(1, times=length(gen1)), rep(2, times=length(gen2))))
SimData <- data.frame(Y,group)
return(SimData)
}
If you look at the code of rpearson
you can see that this function calls an auxiliary function rpearson0
, rpearsonI
, rpearsonII
, ..., or rpearsonVII
, depending on the params
or the moments
argument.如果您查看
rpearson
的代码,您会发现此 function 调用辅助moments
rpearson0
、 rpearsonI
、 rpearsonII
、 ...或rpearsonVII
,具体取决于params
或参数。
Now, the rpearsonIV
function calls the gsl::lngamma_complex
function.现在,
rpearsonIV
function 调用gsl::lngamma_complex
function。 So in order to use this function, you need the gsl
package.所以为了使用这个 function,你需要
gsl
package。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.