[R] Help_urgent_how to calculate mean and sd in biomod 2

Lara Dutra Silva laradutrasilva at gmail.com
Sat Oct 21 02:11:26 CEST 2017


Hello

I am new in R. I am trying to implement Biomod 2 package.

However, I have a doubt. I want to calculate the mean and sd of
"Testing.data"
(ROC and TSS)


> # let's print the ROC scores of all selected models

> myBiomodModelEval_55["ROC","Testing.data",,,]

 RUN1  RUN2  RUN3  RUN4  RUN5  RUN6  RUN7  RUN8  RUN9 RUN10

0.938 0.938 0.926 0.931 0.939 0.918 0.920 0.914 0.935 0.919

>

> # let's print the TSS scores

> myBiomodModelEval_55["TSS","Testing.data",,,]

 RUN1  RUN2  RUN3  RUN4  RUN5  RUN6  RUN7  RUN8  RUN9 RUN10

0.746 0.763 0.717 0.758 0.754 0.704 0.700 0.725 0.742 0.721

>



I try to use "apply"

apply(myBiomodModelEval_55["TSS","Testing.data",,,], 1, mean)

apply(myBiomodModelEval_55["ROC","Testing.data",,,],1, mean)

apply(myBiomodModelEval_55["ROC","Testing.data",,,], 1, sd)

apply(myBiomodModelEval_55["TSS","Testing.data",,,], 1, sd)



I can not figure it out because it runs error.
The problem is in the dimension?

Error in apply(myBiomodModelEval_55["TSS", "Testing.data", , , ], 1, mean) :

  dim(X) must have a positive length

>


How can I solve this?

This is the structure of object

> dimnames(myBiomodModelEval_55)
[[1]]
[1] "ROC" "TSS"

[[2]]
[1] "Testing.data" "Cutoff"       "Sensitivity"  "Specificity"

[[3]]
[1] "GAM"

[[4]]
 [1] "RUN1"  "RUN2"  "RUN3"  "RUN4"  "RUN5"  "RUN6"  "RUN7"  "RUN8"  "RUN9"
[10] "RUN10"

[[5]]
Acacia_AllData
     "AllData"


Regards,
Silva

	[[alternative HTML version deleted]]



More information about the R-help mailing list