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

Rui Barradas ruipbarradas at sapo.pt
Thu Oct 26 22:47:42 CEST 2017


Olá,

Please keep this in the list, I'm cc-ing r-help at r-project.org. And yes, 
I am Portuguese but R-Help is a mailing list in the English language.

As for your new question, I believe that you should start a new thread. 
This is completely different from the question on computing mean and sd. 
Ask a new question.

Font "arial" is a Microsoft font and as far as I know is not supported 
by R. And 'size' is not a graphical parameter. To see the font families 
supported by R see the help page ?par.

Note that width and height are arguments to function ?windows not to 
function plot.

windows(width = 6, height = 5)    # open a new window
plot(1:10, main = "Teste", family = "serif")

#-----------

sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Portugal.1252 
LC_CTYPE=Portuguese_Portugal.1252
[3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C 

[5] LC_TIME=Portuguese_Portugal.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] ggplot2_2.2.1   lubridate_1.6.0

loaded via a namespace (and not attached):
  [1] Rcpp_0.12.13     digest_0.6.12    grid_3.4.2       plyr_1.8.4
  [5] gtable_0.2.0     magrittr_1.5     scales_0.5.0     rlang_0.1.2
  [9] stringi_1.1.5    lazyeval_0.2.0   labeling_0.3     tools_3.4.2
[13] stringr_1.2.0    munsell_0.4.3    compiler_3.4.2   colorspace_1.3-2
[17] tibble_1.3.4


Hope this helps,

Rui Barradas

Em 26-10-2017 21:09, Lara Dutra Silva escreveu:
> Boa noite,
>
> Não sei se português.
>
> Estou a ter algumas dificuldades na alteração do tamanho, letra de um
> plot, ou seja, as alterações básicas.
> Em anexo envio o plot
>
> O código que estou a utilizar é o seguinte:
>
>
> plot(proj90PT$Acacia_EMmeanByTSS_mergedAlgo_mergedRun_mergedData,
> main= "Present", xlab ="a", ylab="b",width=6,height=5)
>
> 1) Queria alterar o tipo de letra para "arial"
> family = "arial" - ocorreu erro
>
> 2) O tamanho da letra
> size =14 - ocorreu erro
>
> 3) font
>
> 4) Tamanho do plot
> (width=6,height=5)
>
>
> Não sei se poderá ajudar-me. Sei que são questões muito básicas.
> Tentei enviar um e-mail para r-help at r-project.org
> <mailto:r-help at r-project.org>
> Cumprimentos,
>
> Lara Silva
>
>
>
> 2017-10-21 13:46 GMT+00:00 Lara Dutra Silva <laradutrasilva at gmail.com
> <mailto:laradutrasilva at gmail.com>>:
>
>     Thank you for the information.
>
>     Regards,
>
>     Lara Silva
>
>     2017-10-21 4:40 GMT+00:00 Rui Barradas <ruipbarradas at sapo.pt
>     <mailto:ruipbarradas at sapo.pt>>:
>
>         Hello,
>
>         This is because myBiomodModelEval_55["ROC","Testing.data",,,] is
>         a vector not an array or matrix. What the error message is
>         saying is that dim() is not returning a value (it's length is
>         not positive, since it cannot be negative length(dim(.)) must be
>         zero). Try it.
>         Or see the class of those objects.
>
>         class(myBiomodModelEval_55["ROC","Testing.data",,,])
>         class(myBiomodModelEval_55["TSS","Testing.data",,,])
>
>
>         You do not apply(), simply do
>
>         mean(myBiomodModelEval_55["ROC","Testing.data",,,])
>
>         And the same for sd().
>
>         Hope this helps,
>
>         Rui Barradas
>
>
>         Em 21-10-2017 01:11, Lara Dutra Silva escreveu:
>
>             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]]
>
>             ______________________________________________
>             R-help at r-project.org <mailto:R-help at r-project.org> mailing
>             list -- To UNSUBSCRIBE and more, see
>             https://stat.ethz.ch/mailman/listinfo/r-help
>             <https://stat.ethz.ch/mailman/listinfo/r-help>
>             PLEASE do read the posting guide
>             http://www.R-project.org/posting-guide.html
>             <http://www.R-project.org/posting-guide.html>
>             and provide commented, minimal, self-contained, reproducible
>             code.
>
>
>
>
>     --
>
>     /Lara Dutra da Silva/
>
>
>
>
> --
>
> /Lara Dutra da Silva/



More information about the R-help mailing list