[R-sig-eco] Plot map in R - center and move labels: x.coords and y.coords

2019-06-21 Thread Lara Silva
Hello,

I am new in R and I want to plot a map,  but I am not able to center and
move the label of "y.coords"

library (rgdal)
p1<-readOGR(".", "WGS")
clab = 0.8
cmain = 2
caxis = 0.8
par(mar=c(4,3,1,1), mgp=c(3, 1, 0), las=1)
plot(p1,asp=1, main= "A - P", xlab="x.coords",
ylab="y.coords",cex.axis=caxis)
#mtext ("y.coords", 1, 1.5)
points(AcaciaP,cex=0.5,pch = 20)
axis(1,at = seq (365000,415000,5000))
axis(2,at = seq (4245000,4275000,5000),pos=365000)

Regards,
Lara
___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] GAM parameters: Biomod 2

2019-06-18 Thread Lara Silva
Hello,

I am using Biomod 2 to modelling species distribution. I ran some
algorithms like GAM, GLM, RF and CTA.

I did not change the parameters. How can I known the quadratic terms of GAM?


I used the variables with form linear (e.g.  precipitation, altimetry,
temperature) I did not use temperature ^2.


Any suggestions?

Regards,


Lara







Sem
vírus. www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Modelling: opinion of new methods

2019-06-07 Thread Lara Silva
Hello everyone!

I am new in modelling species (plants). However, I used some approaches
like ENFA (Biomapper), Maxent, generalized linear and additive models (in
R) and Biomod2.

I would like to improve my knowledge in this area.Currently, what methods
have been used?
Any suggestions?

Regards,

Lara


Sem
vírus. www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Calculate AIC, DIC and BIC for models machine learning

2019-03-23 Thread Lara Silva
Thank you for your advice.

Regards,

Lara

A sábado, 23/03/2019, 04:26, Jane Elith  escreveu:

> Hi Lara, Sarah
> There is a problem in estimation of degrees of freedom so even though some
> people try to estimate AIC eg for Maxent models, it's not correct (the
> number of parameters in the model is not the effective degrees of freedom).
> Same for GBM, RF etc.
> e.g. see Hauenstein, S., Wood, S.N. & Dormann, C.F. (2018) Computing AIC
> for black-box models using generalized degrees of freedom: A comparison
> with cross-validation. Communications in Statistics - Simulation and
> Computation, 47, 1382–1396.
>
> Jane Elith
>
> On 22/3/19, 10:05 pm, "R-sig-ecology on behalf of
> r-sig-ecology-requ...@r-project.org"  on behalf of r-sig-ecology-requ...@r-project.org> wrote:
>
>
> Message: 2
> Date: Thu, 21 Mar 2019 09:55:03 -0400
> From: Sarah Goslee 
> To: Lara Silva 
> Cc: "r-sig-ecology@r-project.org" 
> Subject: Re: [R-sig-eco]  Calculate AIC, DIC and BIC for models
> machine learning
> Message-ID:
>  p6mfnya9r3j+76k9dexd5vhxgz+y6...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Yes, of course it is.
>
> Many of the machine learning packages in R offer AIC as part of their
> model summaries.
>
> You should probably spend some time with the machine learning taskview
> to discover more about R's extensive capabilities.
>
> https://cran.r-project.org/web/views/MachineLearning.html
>
> Sarah
>
> On Thu, Mar 21, 2019 at 9:40 AM Lara Silva 
> wrote:
> >
> > Hello everyone!
> >
> > In R, it is possible to calculate AIC, DIC, or BIC  for models
> machine
> > learning, like RF, ANN, GBM, MARS?
> >
> > Are there any functions or specific packages in R?
> >
> > Any suggestion?
> >
> > Thanks
> >
> > Lara
> >
> > <
> https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail
> >
> > Sem
> > vírus. www.avast.com
> > <
> https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail
> >
> > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> >
> > [[alternative HTML version deleted]]
>
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] R-sig-ecology Digest, Vol 132, Issue 10

2019-03-22 Thread Lara Silva
Prof Dr. Ralf Schäfer

thank you for sharing the links.

Best regards,

Lara Silva

<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail>
Sem
vírus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Ralf Schäfer  escreveu no dia sexta,
22/03/2019 à(s) 11:30:

> Hi Lara,
>
> I am actually not sure that this is the best way to proceed.
> Cross-validation seems the method of choice and depending on your purpose
> you can compare the prediction error between models.
> See: Hauenstein S., Wood S.N. & Dormann C.F. (2018). Computing AIC for
> black-box models using generalized degrees of freedom: A comparison with
> cross-validation. *Communications in Statistics - Simulation and
> Computation* *47*, 1382–1396.
> https://doi.org/10.1080/03610918.2017.1315728
>
> However, these authors provide code to derive an AIC for different machine
> learning approaches. https://github.com/biometry/GDF
>
> Hope this helps and have a nice weekend.
>
> Best regards,
>
> Ralf Schäfer
>
> 
>
> Prof. Dr. Ralf Bernhard Schäfer
> Professor for Quantitative Landscape Ecology
> Environmental Scientist (M.Sc.)
> Institute for Environmental Sciences
> University Koblenz-Landau
> Fortstrasse 7
> 76829 Landau
> Germany
> Mail: schaefer-r...@uni-landau.de
> Phone: ++49 (0) 6341 280-31536
> Web: www.landscapecology.uni-landau.de
>
> Am 22.03.2019 um 12:00 schrieb r-sig-ecology-requ...@r-project.org:
>
>
> Message: 1
> Date: Thu, 21 Mar 2019 12:40:54 -0100
> From: Lara Silva 
> To: r-sig-ecology@r-project.org
> Subject: [R-sig-eco] Calculate AIC, DIC and BIC for models machine
> learning
> Message-ID:
> 
> Content-Type: text/plain; charset="utf-8"
>
> Hello everyone!
>
> In R, it is possible to calculate AIC, DIC, or BIC  for models machine
> learning, like RF, ANN, GBM, MARS?
>
> Are there any functions or specific packages in R?
>
> Any suggestion?
>
> Thanks
>
> Lara
>
>
>
<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail>
Sem
vírus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Calculate AIC, DIC and BIC for models machine learning

2019-03-21 Thread Lara Silva
Hello everyone!

In R, it is possible to calculate AIC, DIC, or BIC  for models machine
learning, like RF, ANN, GBM, MARS?

Are there any functions or specific packages in R?

Any suggestion?

Thanks

Lara


Sem
vírus. www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Error in run GAM (Biomod 2)

2019-03-18 Thread Lara Silva
Thanks for the information.

Drew Tyre  escreveu no dia segunda, 18/03/2019 à(s) 11:48:

> I don't think the number of presences is the problem.
> "A term has fewer unique covariate combinations than specified maximum
> degrees of freedom"
> One of your covariates has a small number of unique values.
> lapply(your_data_frame, function(x)length(unique(x)))
> will print out the number of unique values in each variable. Values < 30
> could be problematic -- the docs are a bit ambiguous on the default values
> of k, the maximum degrees of freedom for a smooth term. Another approach to
> diagnose the problem is to set k to a low value, like 5, and see if that
> makes the problem go away. I'm not familiar with biomod2, but I think doing
> something like
> MO <- BIOMOD_ModelingOptions(GAM  = list(k = 5))
> BIOMOD_Modeling( ..., models.options = MO, ...)
>
> should do it. Note that setting k to a low value causes other problems, I
> would use mcgv::gam.check() to ensure k is large enough, but I don't know
> how to do that with biomod2.
>
> hth
>
> --
> Drew Tyre
>
> School of Natural Resources
> University of Nebraska-Lincoln
> 416 Hardin Hall, East Campus
> 3310 Holdrege Street
> Lincoln, NE 68583-0974
>
> phone: +1 402 472 4054
> fax: +1 402 472 2946
> email: aty...@unl.edu
> http://snr.unl.edu/tyre
> http://drewtyre.rbind.io
> The point is that our true nature is not some ideal that we have to
> live up to. It’s who we are right now, and that’s what we can make friends
> with and celebrate.
> Excerpted from: Awakening Loving-Kindness by Pema Chödrön
>
>
> On 3/18/19, 6:28 AM, "R-sig-ecology on behalf of Lara Silva" <
> r-sig-ecology-boun...@r-project.org on behalf of lara.sfp.si...@gmail.com>
> wrote:
>
> Hello
>
> I am trying to run several algorithms in biomod 2 (GLM, GAM, ANN, SRE)
> but
> I received the following menssage.
>
> Model=GAM
>  GAM_mgcv algorithm chosen
> Automatic formula generation...
> > GAM (mgcv) modelling...Error in
> smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) :
>   A term has fewer unique covariate combinations than specified maximum
> degrees of freedom
> Error in predict(model.bm, Data[, expl_var_names, drop = FALSE],
> on_0_1000
> = TRUE) :
>   object 'model.bm' not found
>
> *** inherits(g.pred,'try-error')
>! Note :  Lactuca.global_AllData_RUN1_GAM failed!
>
> I have 19 presences and 1019 pseudo-absences ...
> It is because the low number of presences?
>
> Thanks
>
> Lara
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Decology=DwICAg=Cu5g146wZdoqVuKpTNsYHeFX_rg6kWhlkLF8Eft-wwo=aLEaSryyUcERVqcKVZl7lQ=2aNX9-kGSZ1EivodV2ZAVeJGY76pX4TqGpx2QXqsx00=-syyYDDESQAcvQx2Khl1KE_jbj3yBD2UqgKcFE4mBpw=
>
>
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Error in run GAM (Biomod 2)

2019-03-18 Thread Lara Silva
Hello

I am trying to run several algorithms in biomod 2 (GLM, GAM, ANN, SRE) but
I received the following menssage.

Model=GAM
 GAM_mgcv algorithm chosen
Automatic formula generation...
> GAM (mgcv) modelling...Error in
smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) :
  A term has fewer unique covariate combinations than specified maximum
degrees of freedom
Error in predict(model.bm, Data[, expl_var_names, drop = FALSE], on_0_1000
= TRUE) :
  object 'model.bm' not found

*** inherits(g.pred,'try-error')
   ! Note :  Lactuca.global_AllData_RUN1_GAM failed!

I have 19 presences and 1019 pseudo-absences ...
It is because the low number of presences?

Thanks

Lara

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] [R-sig-Geo] Error in running Maxent within biomod2

2019-03-14 Thread Lara Silva
Thanks!

Ben Tupper  escreveu no dia quinta, 14/03/2019 à(s)
20:27:

> Hi,
>
> You might want to verify that you have the required maxent jar file
> location properly identified.  See the MAXENT.Philips section here ...
>
>
> https://www.rdocumentation.org/packages/biomod2/versions/3.3-7.1/topics/BIOMOD_ModelingOptions
>
> Cheers,
> Ben
>
>
>
> On Mar 14, 2019, at 5:01 PM, David L Carlson  wrote:
>
> If you don't get an answer here, contact the biomod2 package maintainer.
> The email address is shown on following webpage:
>
> https://cran.r-project.org/web/packages/biomod2/index.html
>
> or you can use the R command:
>
> maintainer("biomod2")
>
> David L. Carlson
> Department of Anthropology
> Texas A University
>
> -Original Message-
> From: R-sig-Geo [mailto:r-sig-geo-boun...@r-project.org] On Behalf Of
> Lara Silva
> Sent: Wednesday, March 13, 2019 6:17 PM
> To: r-sig-ecology@r-project.org; r-sig-...@r-project.org
> Subject: [R-sig-Geo] Error in running Maxent within biomod2
>
> I got an error when running Maxent within biomod2
>
> Running Maxent...Error in system(command = paste("java ",
> ifelse(is.null(Options@MAXENT.Phillips$memory_allocated),  :
>
> What does it means?
>
> Thanks
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> r-sig-...@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> ___
> R-sig-Geo mailing list
> r-sig-...@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
>
> Ecological Forecasting: https://eco.bigelow.org/
>
>
>
>
>
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Error in running Maxent within biomod2

2019-03-13 Thread Lara Silva
I got an error when running Maxent within biomod2

 Running Maxent...Error in system(command = paste("java ",
ifelse(is.null(Options@MAXENT.Phillips$memory_allocated),  :

What does it means?

Thanks

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Doubt_projection map Biomod2

2019-03-13 Thread Lara Silva
Hello,

I am trying to model a species in biomod2 with 4 algorithms.

myBiomodModelOut_2 <- BIOMOD_Modeling(
myBiomodData_2,
models=c('GLM','GAM','ANN', 'SRE'),
NbRunEval=10,
DataSplit=70,
Yweights=NULL,
VarImport=10,
models.eval.meth=c('ROC','TSS'), # evaluation metrics will be calculated
SaveObj=TRUE,
rescal.all.models=TRUE,
do.full.models=FALSE,
modeling.id=paste(myRespName,"test", sep=""))

#building the ensemble models
myBiomodEM_2<-BIOMOD_EnsembleModeling(modeling.output=myBiomodModelOut_2,
chosen.models="all",
em.by="all",
eval.metric=c("TSS","ROC"),
eval.metric.quality.threshold=c(0.4,0.7), # all models with TSS<0.4 and
#ROC<0.7 are excluded
prob.mean=T,
prob.cv=FALSE,
prob.ci=FALSE,
prob.ci.alpha=0.05,
prob.median=FALSE,
committee.averaging=FALSE,
prob.mean.weight=FALSE,
prob.mean.weight.decay="proportional",
VarImport = 10) #calculate variable importances for ensemble models
#print variable importances for ensemble models
get_variables_importance(myBiomodEM_2)
#get evaluation scores for ensemble models
get_evaluations(myBiomodEM_2)

*However I want to project the model "GAM"*
*Error any models selected.*

### projection Present

myBiomodProj_3P <- BIOMOD_Projection(
modeling.output = myBiomodModelOut_3,
new.env = grid.present.project,
proj.name = 'current',
selected.models="all", # I have tried  *selected.models="GAM"*
binary.meth=c("TSS","ROC"),
compress = 'xz',
clamping.mask = F,
output.format = '.grd')

How can I do? Any sugestion?

Thanks





Sem
vírus. www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] AIC in Biomod 2

2019-03-11 Thread Lara Silva
Thanks!

David L Carlson  escreveu no dia domingo, 10/03/2019
à(s) 16:27:

> I searched the manual for package biomed2 and found 6 references to "AIC".
> Perhaps that is your answer.
>
> David L. Carlson
> Department of Anthropology
> Texas A University
>
> -Original Message-
> From: R-sig-ecology [mailto:r-sig-ecology-boun...@r-project.org] On
> Behalf Of Lara Silva
> Sent: Saturday, March 9, 2019 5:32 PM
> To: r-sig-ecology@r-project.org
> Subject: [R-sig-eco] AIC in Biomod 2
>
> Hello
>
> Is there any way to calculate the AIC in Biomod 2?
>
> Thanks,
>
> Lara
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] AIC in Biomod 2

2019-03-09 Thread Lara Silva
Hello

Is there any way to calculate the AIC in Biomod 2?

Thanks,

Lara

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Vegan_package: Plot PCA

2019-02-27 Thread Lara Silva
Thank you!

Eduard Szöcs  escreveu no dia terça, 26/02/2019 à(s)
23:24:

> biplot() has a "choices" argument for this.
>
> Eduard
>
> Am 27. Feb. 2019, um 01:19, Lara Silva  schrieb:
>>
>> Hello,
>>
>> I am using the VEGAN package to do PCA of my variables.
>>
>>
>> bio.pca <- rda(variables, scale=TRUE) # Argument scale=TRUE
>>
>> bio.pca
>>
>> summary(bio.pca) # Default scaling 2
>>
>> summary(bio.pca, scaling=2)
>>
>>
>>
>> sum_bio <-summary(bio.pca)
>>
>> names(sum_bio)
>>
>> sum_bio$species
>>
>>
>>
>> #make basic plot
>>
>> biplot(env.pca,
>>
>>display = c("sites",
>>
>>"species"),
>>
>>type = c("text",
>>
>> "points"))
>>
>>
>>
>> In my plot I have PCA 1 e PCA 2. Is there a way to plot the PCA 3?
>>
>>
>> Thanks,
>>
>>
>> Lara
>>
>>  [[alternative HTML version deleted]]
>>
>> --
>>
>> R-sig-ecology mailing list
>> R-sig-ecology@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Vegan_package: Plot PCA

2019-02-27 Thread Lara Silva
Thank you!

Abdoul Dia  escreveu no dia terça, 26/02/2019 à(s)
23:38:

> If I do understand this is what you are looking for :
>
> plot(x, choices = c(1, 2), display = c("sp", "wa", "cn"),
>  scaling = 2, type, xlim, ylim, const, ...)
>
>
> The option choices helps you to select the axis. In your case it would be 
> choices = c(1,3) [axis 1 vs 3] or choices = c(2,3) [axis 2 vs 3]
>
> Hope this would help you.
>
>
> Abdoul
>
>
> Le mar. 26 févr. 2019 à 19:20, Lara Silva  a
> écrit :
>
>> Hello,
>>
>> I am using the VEGAN package to do PCA of my variables.
>>
>>
>> bio.pca <- rda(variables, scale=TRUE) # Argument scale=TRUE
>>
>> bio.pca
>>
>> summary(bio.pca) # Default scaling 2
>>
>> summary(bio.pca, scaling=2)
>>
>>
>>
>> sum_bio <-summary(bio.pca)
>>
>> names(sum_bio)
>>
>> sum_bio$species
>>
>>
>>
>> #make basic plot
>>
>> biplot(env.pca,
>>
>>display = c("sites",
>>
>>"species"),
>>
>>type = c("text",
>>
>> "points"))
>>
>>
>>
>> In my plot I have PCA 1 e PCA 2. Is there a way to plot the PCA 3?
>>
>>
>> Thanks,
>>
>>
>> Lara
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-sig-ecology mailing list
>> R-sig-ecology@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>
>
> --
> Abdoul Ousmane DIA
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Vegan_package: Plot PCA

2019-02-26 Thread Lara Silva
Hello,

I am using the VEGAN package to do PCA of my variables.


bio.pca <- rda(variables, scale=TRUE) # Argument scale=TRUE

bio.pca

summary(bio.pca) # Default scaling 2

summary(bio.pca, scaling=2)



sum_bio <-summary(bio.pca)

names(sum_bio)

sum_bio$species



#make basic plot

biplot(env.pca,

   display = c("sites",

   "species"),

   type = c("text",

"points"))



In my plot I have PCA 1 e PCA 2. Is there a way to plot the PCA 3?


Thanks,


Lara

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Select a percentage of combinations

2019-02-26 Thread Lara Silva
Thank you very much!

Regards,

Lara


Shane Baylis  escreveu no dia terça, 26/02/2019
à(s) 01:53:

> Hi Lara,
>
> You want to subset out 20% of the columns from a matrix, at random. Try:
>
> combinations <- combn(20,3)  ## makes the 'all combinations' matrix
> sample <- combinations[,sample(1:ncol(combinations),
> floor(ncol(combinations)*0.2))] ## subsets out 20% of the columns from that
> object.
> ## Note that sample() samples without replacement, by default.
> sample
>
> Hope that helps!
> Shane
>
> On Tue, 26 Feb 2019 at 12:38, Lara Silva  wrote:
>
>> Hello,
>>
>> I want to select  sets of combinations, but I do not want use all 1140
>>
>> combn (20,3)
>>
>> choose (20,3) - total of  1140.
>>
>> [,1091] [,1092] [,1093] [,1094] [,1095] [,1096] [,1097] [,1098]
>> [,1099]
>> [,1100]
>> [1,]  13  13  13  13  13  13  13  13
>> 13  13
>> [2,]  15  15  15  15  15  16  16  16
>> 16  17
>> [3,]  16  17  18  19  20  17  18  19
>> 20  18
>>  [,1101] [,1102] [,1103] [,1104] [,1105] [,1106] [,1107] [,1108]
>> [,1109] [,1110]
>> [1,]  13  13  13  13  13  14  14  14
>> 14  14
>> [2,]  17  17  18  18  19  15  15  15
>> 15  15
>> [3,]  19  20  19  20  20  16  17  18
>> 19  20
>>  [,] [,1112] [,1113] [,1114] [,1115] [,1116] [,1117] [,1118]
>> [,1119] [,1120]
>> [1,]  14  14  14  14  14  14  14  14
>> 14  14
>> [2,]  16  16  16  16  17  17  17  18
>> 18  19
>> [3,]  17  18  19  20  18  19  20  19
>> 20  20
>>  [,1121] [,1122] [,1123] [,1124] [,1125] [,1126] [,1127] [,1128]
>> [,1129] [,1130]
>> [1,]  15  15  15  15  15  15  15  15
>> 15  15
>> [2,]  16  16  16  16  17  17  17  18
>> 18  19
>> [3,]  17  18  19  20  18  19  20  19
>> 20  20
>>  [,1131] [,1132] [,1133] [,1134] [,1135] [,1136] [,1137] [,1138]
>> [,1139] [,1140]
>> [1,]  16  16  16  16  16  16  17  17
>> 17  18
>> [2,]  17  17  17  18  18  19  18  18
>> 19  19
>> [3,]  18  19  20  19  20  20  19  20
>> 20  20
>>
>>
>> If it possible to select 20% of this combinations (sets)?
>> It is important to generate a random sample ...
>>
>> Example
>>
>> 15  1  8 ...
>> 16  7  20
>> 17 20  13...
>>
>> Any advice?
>>
>> Thanks,
>>
>> Lara
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-sig-ecology mailing list
>> R-sig-ecology@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Select a percentage of combinations

2019-02-25 Thread Lara Silva
Hello,

I want to select  sets of combinations, but I do not want use all 1140

combn (20,3)

choose (20,3) - total of  1140.

[,1091] [,1092] [,1093] [,1094] [,1095] [,1096] [,1097] [,1098] [,1099]
[,1100]
[1,]  13  13  13  13  13  13  13  13
13  13
[2,]  15  15  15  15  15  16  16  16
16  17
[3,]  16  17  18  19  20  17  18  19
20  18
 [,1101] [,1102] [,1103] [,1104] [,1105] [,1106] [,1107] [,1108]
[,1109] [,1110]
[1,]  13  13  13  13  13  14  14  14
14  14
[2,]  17  17  18  18  19  15  15  15
15  15
[3,]  19  20  19  20  20  16  17  18
19  20
 [,] [,1112] [,1113] [,1114] [,1115] [,1116] [,1117] [,1118]
[,1119] [,1120]
[1,]  14  14  14  14  14  14  14  14
14  14
[2,]  16  16  16  16  17  17  17  18
18  19
[3,]  17  18  19  20  18  19  20  19
20  20
 [,1121] [,1122] [,1123] [,1124] [,1125] [,1126] [,1127] [,1128]
[,1129] [,1130]
[1,]  15  15  15  15  15  15  15  15
15  15
[2,]  16  16  16  16  17  17  17  18
18  19
[3,]  17  18  19  20  18  19  20  19
20  20
 [,1131] [,1132] [,1133] [,1134] [,1135] [,1136] [,1137] [,1138]
[,1139] [,1140]
[1,]  16  16  16  16  16  16  17  17
17  18
[2,]  17  17  17  18  18  19  18  18
19  19
[3,]  18  19  20  19  20  20  19  20
20  20


If it possible to select 20% of this combinations (sets)?
It is important to generate a random sample ...

Example

15  1  8 ...
16  7  20
17 20  13...

Any advice?

Thanks,

Lara

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Use rbind for more than two data frame

2019-02-21 Thread Lara Silva
Thanks for the advice!

Mollie Brooks  escreveu no dia quinta, 21/02/2019
à(s) 11:31:

> Try changing  "bio15_FP" to  "bio15" so that the names match.
>
>
> On 21Feb 2019, at 13:29, Lara Silva  wrote:
>
> Hello,
>
> I am trying to join different data frames using rbind but I have the
> following mensage:
>
> sdmata_global <-
> rbind(sdmdata_SM,sdmdata_P,sdmdata_T,sdmdata_F,sdmdata_SJ)
>
> Error in match.names(clabs, names(xi)) :
> names do not match previous names
>
> class(sdmdata_SM)
>
> [1] "data.frame"
>
> class(sdmdata_P)
>
> [1] "data.frame"
>
> class(sdmdata_T)
>
> [1] "data.frame"
>
> class(sdmdata_F)
>
> [1] "data.frame"
>
> class(sdmdata_SJ)
>
> [1] "data.frame"
>
> dim(sdmdata_SM)
>
> [1] 1000322
>
> dim(sdmdata_P)
>
> [1] 1000522
>
> dim(sdmdata_T)
>
> [1] 1000422
>
> dim(sdmdata_F)
>
> [1] 1000122
>
> dim(sdmdata_SJ)
>
> [1] 1000122
>
>
> dim(sdmdata_SM)
>
> [1] 1000322
>
> dim(sdmdata_SM)
>
> [1] 1000322
>
> dim(sdmdata_P)
>
> [1] 1000522
>
> dim(sdmdata_T)
>
> [1] 1000422
>
> dim(sdmdata_F)
>
> [1] 1000122
>
> dim(sdmdata_SJ)
>
> [1] 1000122
>
>
>
> names(sdmdata_SM)
>
> [1] "pb""bio1"  "bio10" "bio11" "bio12" "bio13" "bio14" "bio15" "bio16"
> [10] "bio17" "bio18" "bio19" "bio2"  "bio3"  "bio4"  "bio4a" "bio5"  "bio6"
> [19] "bio7"  "bio8"  "bio9"  "code"
>
> names(sdmdata_P)
>
> [1] "pb""bio1"  "bio10" "bio11" "bio12" "bio13" "bio14" "bio15" "bio16"
> [10] "bio17" "bio18" "bio19" "bio2"  "bio3"  "bio4"  "bio4a" "bio5"  "bio6"
> [19] "bio7"  "bio8"  "bio9"  "code"
>
> names(sdmdata_T)
>
> [1] "pb""bio1"  "bio10" "bio11" "bio12" "bio13" "bio14" "bio15" "bio16"
> [10] "bio17" "bio18" "bio19" "bio2"  "bio3"  "bio4"  "bio4a" "bio5"  "bio6"
> [19] "bio7"  "bio8"  "bio9"  "code"
>
> names(sdmdata_F)
>
> [1] "pb"   "bio1" "bio10""bio11""bio12""bio13"
> [7] "bio14""bio15_FP" "bio16""bio17""bio18""bio19"
> [13] "bio2" "bio3" "bio4" "bio4a""bio5" "bio6"
> [19] "bio7" "bio8" "bio9" "code"
>
> names(sdmdata_SJ)
>
> [1] "pb""bio1"  "bio10" "bio11" "bio12" "bio13" "bio14" "bio15" "bio16"
> [10] "bio17" "bio18" "bio19" "bio2"  "bio3"  "bio4"  "bio4a" "bio5"  "bio6"
> [19] "bio7"  "bio8"  "bio9"  "code"
>
>
>
> Any suggestion?
>
> Thanks!
>
> Lara
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
>
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Use rbind for more than two data frame

2019-02-21 Thread Lara Silva
Hello,

I am trying to join different data frames using rbind but I have the
following mensage:

sdmata_global <-
rbind(sdmdata_SM,sdmdata_P,sdmdata_T,sdmdata_F,sdmdata_SJ)

Error in match.names(clabs, names(xi)) :
names do not match previous names

> class(sdmdata_SM)
[1] "data.frame"
> class(sdmdata_P)
[1] "data.frame"
> class(sdmdata_T)
[1] "data.frame"
> class(sdmdata_F)
[1] "data.frame"
> class(sdmdata_SJ)
[1] "data.frame"
> dim(sdmdata_SM)
[1] 1000322
> dim(sdmdata_P)
[1] 1000522
> dim(sdmdata_T)
[1] 1000422
> dim(sdmdata_F)
[1] 1000122
> dim(sdmdata_SJ)
[1] 1000122


> dim(sdmdata_SM)
[1] 1000322
> dim(sdmdata_SM)
[1] 1000322
> dim(sdmdata_P)
[1] 1000522
> dim(sdmdata_T)
[1] 1000422
> dim(sdmdata_F)
[1] 1000122
> dim(sdmdata_SJ)
[1] 1000122
>

> names(sdmdata_SM)
 [1] "pb""bio1"  "bio10" "bio11" "bio12" "bio13" "bio14" "bio15" "bio16"
[10] "bio17" "bio18" "bio19" "bio2"  "bio3"  "bio4"  "bio4a" "bio5"  "bio6"
[19] "bio7"  "bio8"  "bio9"  "code"
> names(sdmdata_P)
 [1] "pb""bio1"  "bio10" "bio11" "bio12" "bio13" "bio14" "bio15" "bio16"
[10] "bio17" "bio18" "bio19" "bio2"  "bio3"  "bio4"  "bio4a" "bio5"  "bio6"
[19] "bio7"  "bio8"  "bio9"  "code"
> names(sdmdata_T)
 [1] "pb""bio1"  "bio10" "bio11" "bio12" "bio13" "bio14" "bio15" "bio16"
[10] "bio17" "bio18" "bio19" "bio2"  "bio3"  "bio4"  "bio4a" "bio5"  "bio6"
[19] "bio7"  "bio8"  "bio9"  "code"
> names(sdmdata_F)
 [1] "pb"   "bio1" "bio10""bio11""bio12""bio13"
 [7] "bio14""bio15_FP" "bio16""bio17""bio18""bio19"
[13] "bio2" "bio3" "bio4" "bio4a""bio5" "bio6"
[19] "bio7" "bio8" "bio9" "code"
> names(sdmdata_SJ)
 [1] "pb""bio1"  "bio10" "bio11" "bio12" "bio13" "bio14" "bio15" "bio16"
[10] "bio17" "bio18" "bio19" "bio2"  "bio3"  "bio4"  "bio4a" "bio5"  "bio6"
[19] "bio7"  "bio8"  "bio9"  "code"
>

Any suggestion?

Thanks!

Lara

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Problem in generate random samples in r

2019-02-20 Thread Lara Silva
Thanks!

Lara

Henrik Eckermann  escreveu no dia quarta,
20/02/2019 à(s) 10:25:

> Hi Lara,
>
> the error is quite informative. You use the sample function twice. At
> least for one the length of the vector where you sample from is shorter
> (contains less values) than than the number of samples you wanna draw.
>
> best,
>
> Henrik
>
> > On 20. Feb 2019, at 12:20, Lara Silva  wrote:
> >
> > Hello,
> >
> > I am trying to generate random samples from the following code
> >
> > ### Setting random seed to always create the same
> > ### Random set of points
> > set.seed(0)
> >
> > absences_15000<-absences[sample(nrow(absences), 15000),]
> > points(absences_15000, cex=0.1)
> >
> > ## Subsample_1
> > set.seed(0)
> >
> > absences_1<-absences_15000[sample(nrow(absences_15000), 1),]
> > dim(absences_1)
> >
> > I get the following error:
> >
> > Error in sample.int(length(x), size, replace, prob) :
> >  cannot take a sample larger than the population when 'replace = FALSE'
> >
> > Any advice?
> >
> > Regards,
> >
> > Lara
> >
> >   [[alternative HTML version deleted]]
> >
> > ___
> > R-sig-ecology mailing list
> > R-sig-ecology@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Problem in generate random samples in r

2019-02-20 Thread Lara Silva
Hello,

I am trying to generate random samples from the following code

### Setting random seed to always create the same
### Random set of points
set.seed(0)

absences_15000<-absences[sample(nrow(absences), 15000),]
points(absences_15000, cex=0.1)

## Subsample_1
set.seed(0)

absences_1<-absences_15000[sample(nrow(absences_15000), 1),]
dim(absences_1)

I get the following error:

Error in sample.int(length(x), size, replace, prob) :
  cannot take a sample larger than the population when 'replace = FALSE'

Any advice?

Regards,

Lara

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] How to manipulatechange the space between the numbers of axes (equal interval)? How to add a legend to a map (plot raster)?

2018-11-29 Thread Lara Silva
Hello,
 I´m trying to plot a map in R. Is it possible to change the values of
x.axis and y.axis and have the same interval (space between the numbers)?
 How to add a legend for the map?

https://www.dropbox.com/s/60tavy6vez33mw3/Plot_map.tiff?dl=0

> class(proj22PA$P_EMmeanByROC_mergedAlgo_mergedRun_mergedData)
[1] "RasterLayer"
attr(,"package")
[1] "raster"
>
> proj22PA$P_EMmeanByROC_mergedAlgo_mergedRun_mergedData
class   : RasterLayer
band: 2  (of  2  bands)
dimensions  : 277, 412, 114124  (nrow, ncol, ncell)
resolution  : 100, 100  (x, y)
extent  : 461214, 502414, 4272892, 4300592  (xmin, xmax, ymin, ymax)
coord. ref. : NA
data source : grid
names   : P_EMmeanByROC_mergedAlgo_mergedRun_mergedData
values  : 42, 924  (min, max)

>

Code:

plot(proj22PA$P_EMmeanByROC_mergedAlgo_mergedRun_mergedData,
axes=FALSE,legend=FALSE,box=FALSE,par(mar=c(3,3,0.5,0.5),mgp=c(2,1,0)))
axis(side = 1, at =c(47,48,50),labels= c("47", "48",
"50"))
axis(side = 2, at =c(4272892,4300592),labels= c("4272892", "4300592"))
box()

Regards,

Silva

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology