Re: [R-sig-eco] ordipointlabel with shortened names
Resending as I had some mail trouble yesterday and don't see this one to have gone through. See in-line below... On Tue, 2013-06-18 at 12:58 -0700, Kevin McCluney wrote: > Hi, > > I've been trying to use ordipointlabel() to add taxa names to an nmds > (metaMDS) graph in VEGAN. I can add the full names from the database, but I > would like to use the shortened names I created using make.cepnames(). I've > tried: > > pl3v2 <- ordipointlabel(mds, dis="sp", add = TRUE, lab=shnam) I'm afraid this is not possible yet - the labels are hard coded from the species scores. Hence I suggest you do names(foo) <- make.cepnames(names(foo)) where foo is your data frame. Then refit the NMDS. I'll see about allowing the passing in of labels but it won't happen for a few weeks. HTH G > But I get the following error message: > > Error in text.default(lab, labels = labels, col = col, cex = cex, font = > font, : > graphical parameter "lab" has the wrong length > In addition: Warning message: > In text.default(lab, labels = labels, col = col, cex = cex, font = font, : > NAs introduced by coercion > > I've also tried "labels" instead of "lab" and I get: > > Error in text.default(lab, labels = labels, col = col, cex = cex, font = > font, : > formal argument "labels" matched by multiple actual arguments > > I guess this function doesn't yet work like orditorp? Can anyone think of a > workaround? > > I've tried orditkplot: > > orditkplot(pl3v2, dis = "sp") > > But I get this error: > > Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"), class = > "tclObj") : > [tcl] bad screen distance "-NaN". > > I've also tried using identify(), but I have a few taxa that are literally > right on top of each other and try as I might, I can't get all of the taxa > that are on top of each other to show up. > > Any help would be appreciated. Thanks! > > Kevin E. McCluney, PhD > Post-doctoral Research Scholar > Department of Entomology > North Carolina State University > > > > -- > View this message in context: > http://r-sig-ecology.471788.n2.nabble.com/ordipointlabel-with-shortened-names-tp7578224.html > Sent from the r-sig-ecology mailing list archive at Nabble.com. > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology > -- Gavin Simpson, PhD [t] +1 306 337 8863 Adjunct Professor, Department of Biology[f] +1 306 337 2410 Institute of Environmental Change & Society [e] gavin.simp...@uregina.ca 523 Research and Innovation Centre [tw] @ucfagls University of Regina Regina, SK S4S 0A2, Canada -- Gavin Simpson, PhD [t] +1 306 337 8863 Adjunct Professor, Department of Biology[f] +1 306 337 2410 Institute of Environmental Change & Society [e] gavin.simp...@uregina.ca 523 Research and Innovation Centre [tw] @ucfagls University of Regina Regina, SK S4S 0A2, Canada ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[R-sig-eco] New book: Beginner's Guide to GLM and GLMM with R
Members of this mailing list may be interested in the following new book: Beginner's Guide to GLM and GLMM with R. - A frequentist and Bayesian perspective for ecologists - Zuur AF, Hilbe JM and Ieno EN This book is only available from: http://www.highstat.com/BGGLM.htm This book presents Generalized Linear Models (GLM) and Generalized Linear Mixed Models (GLMM) based on both frequency-based and Bayesian concepts. Using ecological data from real-world studies, the text introduces the reader to the basics of GLM and mixed effects models, with demonstrations of binomial, gamma, Poisson, negative binomial regression, and beta and beta-binomial GLMs and GLMMs. The book uses the functions glm, lmer, glmer, glmmADMB, and also JAGS from within R. JAGS results are compared with frequentist results. R code to construct, fit, interpret, and comparatively evaluate models is provided at every stage. Otherwise challenging procedures are presented in a clear and comprehensible manner with each step of the modelling process explained in detail, and all code is provided so that it can be reproduced by the reader. Readers of this book have free access to: Chapter 1 of Zero Inflated Models and Generalized Linear Mixed Models with R. (2012a) Zuur, Saveliev, Ieno. Chapter 1 of Beginner's Guide to Generalized Additive Models with R. (2012b) Zuur, AF. Keywords Introduction to GLM Poisson GLM and Negative binomial GLM for count data Binomial GLM for binary data Binomial GLM for proportional data Other distributions GLM applied to red squirrel data Bayesian approach – running the Poisson GLM Running JAGS via R Applying a negative binomial GLM in JAGS GLM applied to presence-absence Polychaeta data Model selection using AIC, DIC and BIC in jags Introduction to mixed effects models GLMM applied on honeybee pollination data Poisson GLMM using glmer and JAGS Negative binomial GLMM using glmmADMD and JAGS GLMM with auto-regressive correlation GLMM for strictly positive data: biomass of rainforest trees gamma GLM using a frequentist approach Fitting a gamma GLM using JAGS Truncated Gaussian linear regression Tobit model in JAGS Tobit model with random effects in JAGS Binomial, beta-binomial, and beta GLMM applied to cheetah data Kind regards, Alain Zuur -- Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. URL: www.springer.com/0-387-45967-7 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer http://www.springer.com/statistics/computational/book/978-0-387-93836-3 4. Zero Inflated Models and Generalized Linear Mixed Models with R. (2012) Zuur, Saveliev, Ieno. http://www.highstat.com/book4.htm Other books: http://www.highstat.com/books.htm Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Tel: 0044 1358 788177 Email: highs...@highstat.com URL: www.highstat.com URL: www.brodgar.com ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Working with trajectories: ltraj.
[snip] I am trying to select only a part of the trajectory stored in this ltraj class object, following an example from Calenge in the package 'adehabitatLT': lim <- as.POSIXct(strptime(c("28/05/2010 02:00:40", "30/06/2010 02:00:41"), "%d/%m/%Y %H:%M:%S")) ltrj.bis <- gdltraj(ltrj.obj, min=lim[1], max=lim[2], type="POSIXct" ) but for some reasons it does not work properly. I got this error message that I do not understand: Error in `[.default`(res, , names(res) %in% which, drop = FALSE) : number of dimensions incorrect Anyone has an idea about why it doesn't work? You have identified a bug in the function gdltraj. I have corrected this bug and uploaded a new version of the package to CRAN. It will be available soon. Meanwhile, you can use this function instead: gdltraj <- function (x, min, max, type = c("POSIXct", "sec", "min", "hour", "mday", "mon", "year", "wday", "yday")) { if (!inherits(x, "ltraj")) stop("x should be of class \"ltraj\"") if (!attr(x, "typeII")) stop("x should be of type II (time recorded)") type <- match.arg(type) if (type == "POSIXct") { x <- lapply(x, function(y) { infol <- attr(y, "infolocs") if (!is.null(infol)) infol <- infol[(y$date > min) & (y$date < max), , drop=FALSE] y <- y[(y$date > min) & (y$date < max), ] if (!is.null(infol)) attr(y, "infolocs") <- infol return(y) }) } else { x <- lapply(x, function(y) { da <- as.POSIXlt(y$date)[[type]] infol <- attr(y, "infolocs") if (!is.null(infol)) infol <- infol[(da >= min) & (da < max), ,drop=FALSE] y <- y[(da >= min) & (da < max), ] if (!is.null(infol)) attr(y, "infolocs") <- infol return(y) }) } if (all(sapply(x, nrow) == 0)) stop("No relocations within the specified interval") x[sapply(x, nrow) == 0] <- NULL class(x) <- c("ltraj", "list") attr(x, "typeII") <- TRUE attr(x, "regular") <- is.regular(x) x <- rec(x) return(x) } HTH Clément Calenge -- Clément CALENGE Cellule d'appui à l'analyse de données Direction des Etudes et de la Recherche Office national de la chasse et de la faune sauvage Saint Benoist - 78610 Auffargis tel. (33) 01.30.46.54.14 ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[R-sig-eco] Working with trajectories: ltraj.
Hi again, I am still working on class object ltraj. Here you have the summary of my trajectory: > summary(ltrj.obj)id burst nb.reloc NAs date.begin > date.end 1 Alma Alma 136 0 2010-05-01 02:00:56 2010-06-30 02:00:41 and the output of the head function: > head(ltrj.obj[[1]])x ydate dx dy dist >dtR2n abs.angle rel.angle 1 1593865 7459671 2010-05-01 02:00:5600 0.00 32398 0NA NA 2 1593865 7459671 2010-05-01 11:00:54 -23 3.605551 32399 0 2.158799 NA 3 1593863 7459674 2010-05-01 20:00:53 202 -382 432.120354 21632 13 -1.084378 3.0400080 4 1594065 7459292 2010-05-02 02:01:25 -241 -303 387.156299 32493 183641 -2.242714 -1.1583352 5 1593824 7458989 2010-05-02 11:02:58 -101 367 380.644191 32276 466805 1.839353 -2.2011192 6 1593723 7459356 2010-05-02 20:00:54 188 293 348.127850 21590 119389 1.000322 -0.8390307 I am trying to select only a part of the trajectory stored in this ltraj class object, following an example from Calenge in the package 'adehabitatLT': lim <- as.POSIXct(strptime(c("28/05/2010 02:00:40", "30/06/2010 02:00:41"), "%d/%m/%Y %H:%M:%S")) ltrj.bis <- gdltraj(ltrj.obj, min=lim[1], max=lim[2], type="POSIXct" ) but for some reasons it does not work properly. I got this error message that I do not understand: Error in `[.default`(res, , names(res) %in% which, drop = FALSE) : number of dimensions incorrect Anyone has an idea about why it doesn't work? Thankx a lot. Cheers -- Dylann Kersusan Master Biodiversity and Conservation Zoology dept. Stockholm University -- Grimsö Wildlife Research Center Ecology dept. SLU Riddarhyttan-Sweden [[alternative HTML version deleted]] ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology