Re: [R-sig-eco] terra package SpatVector format
Hi, I think terra::crs() does what you are looking for. More broadly, I think your workflow would be more efficient and simpler if you take the time now to switch over to terra functions like terra::project(), rather than retain so many sp functions. There's excellent documentation available here: https://rspatial.org/ Sarah On Sun, Nov 19, 2023 at 11:39 PM José Hidasi Neto wrote: > > Hello everyone, > > I'm trying to update my package "bivariatemaps", but I'm having a problem > with SpatVector and SpatRaster formats from the new terra package. > > For example: > > GridFilter<-function(shape, resol = 1, prop = 0){ > grid <- terra::rast(terra::ext(shape)) > terra::res(grid) <- resol > *sp::proj4string(grid)*<-*sp::proj4string(shape)* > gridpolygon <- terra::rasterToPolygons(grid) > drylandproj<-sp::spTransform(shape, sp::CRS("+proj=laea")) > gridpolproj<-sp::spTransform(gridpolygon, sp::CRS("+proj=laea")) > gridpolproj$layer <- c(1:length(gridpolproj$layer)) > areagrid <- terra::expanse(gridpolproj, byid=T) > dry.grid <- terra::intersect(drylandproj, gridpolproj) > areadrygrid <- terra::expanse(dry.grid, byid=T) > info <- cbind(dry.grid$layer, areagrid[dry.grid$layer], areadrygrid) > dry.grid$layer<-info[,3]/info[,2] > dry.grid <- sp::spTransform(dry.grid, sp::CRS(sp::proj4string(shape))) > dry.grid.filtered <- dry.grid[dry.grid$layer >= prop,]} > > > When it tries to use pro4string on the grid and the shape, it doesn't work. > > > sp::proj4string(grid)Error in (function (classes, fdef, mtable) : > unable to find an inherited method for function ‘proj4string’ for > signature ‘"SpatRaster"’ > > > sp::proj4string(shape)Error in (function (classes, fdef, mtable) : > unable to find an inherited method for function ‘proj4string’ for > signature ‘"SpatVector"’ > > > > Is there any function that works with these new formats? > > All the best, > José Hidasi-Neto > -- > José Hidasi Neto > Ph.D. in Ecology and Evolution > Lattes: > http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4293841A0 > My blog about science and R: https://rfunctions.blogspot.com > > [[alternative HTML version deleted]] > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee (she/her) http://www.numberwright.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] On The Choice of a Classification Approach
Hi, I think I understand what you're after, but if not then please correct me/expand on your question. The datasets like iris that you reference are for supervised classification, where the true values are known and the goal is to quantitatively predict which species an individual belongs to based on its attributes. What you have is an unsupervised classification problem, where you want to group species based on their attributes without knowing the answer first. The species name is irrelevant here, except as a reference for you, because you don't yet know anything about the group membership. You're right that you can't do a classification tree, because you don't already know the groups. I think by threshold values you're actually looking for a predict method that can assign new species to the existing clusters, right? That's doable. Many clustering functions, like flexclust::kcca offer predict methods directly. After that, the better question is how do the assumptions of different clustering methods fit your understanding of the structure of the data? Do you want hierarchical classification into nested groups and subgroups? Or do you NOT want that structure, in which case a partitioning method might be more appropriate. Are the variables correlated? Do you need to create uncorrelated variables? Is there a particular distance metric that would be more suitable for your data? Does it have to work with correlated variables? And so on. If it were my data, I'd also do an ordination and look at the structure in reduced dimensions. Sarah On Mon, Nov 1, 2021 at 3:39 PM Alexandre F. Souza wrote: > > Hello, > > I am trying to find a method to cluster species based on their quantitative > traits and at the same time obtain threshold value for each node in the > decision tree. My difficulty is that my dependent variable is the list of > species names, each species appearing as a single line with no repetition. > All explanatory variables are quantitative. As far as I understood, > classification trees need a dependent variable with repeated levels as in > the iris dataset, in which each species appears several times. All the > examples employing classification trees I found use a dependent variable, > but I do not have one except for the species names. MRT uses a species by > location matrix as dependent variable, and traditional hierarchical cluster > analysis do cluster species but do not use quantitative data to that aim, > nor produce threshold values. I can run a non-hierarquical cluster analysis > like kmeans, but these do not generate threshold values. My concern is that > without threshold values any classification I produce will be restricted to > the studied species and will not be applicable to different species that > can be found in the studied region, what would be a strong limitation to > the use of such classification. > > Thank you very much in advance for any ideas. > > Regards, > > Alexandre > > > -- > Dr. Alexandre F. Souza > Professor Associado > Chefe do Departamento de Ecologia > Universidade Federal do Rio Grande do Norte > CB, Departamento de Ecologia > Campus Universitário - Lagoa Nova > 59072-970 - Natal, RN - Brasil > lattes: lattes.cnpq.br/7844758818522706 > http://www.esferacientifica.com.br > https://www.youtube.com/user/alexfadigas > http://www.docente.ufrn.br/alexsouza > orcid.org/-0001-7468-3631 <http://www.docente.ufrn.br/alexsouza> > > [[alternative HTML version deleted]] > > _______ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee (she/her) http://www.numberwright.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] focal point with function using multiple rasters
Hi, Since you are starting from scratch, I'd suggest looking into the terra package, documented here: https://rspatial.org/terra/pkg/index.html The focal() function is probably what you're looking for, but you will need to read some of the docs to learn how to load and work with raster data in general. You'll also need to think more rigorously about how you want to calculate climatic distance for an individual grid cell. The distance() function in terra might help, but it isn't clear to me which of the many approaches you wish to implement. Sarah On Tue, Mar 16, 2021 at 9:58 AM Diogo André Alagador wrote: > > Dear colleagues. > > > > I have 4 equal-sized rasters respecting 4 climate variables. > > I would like to have for each cell the weighted-average climatic distance > (in the Euclidean space defined by the 4 variables) to its 8 closest > neighboring cells, with weight related to the geographic distances. > > Can someone guide me on how to do it? > > > > Thanks in advance, > > Best regards, > > Diogo Alagador > > MED, University of Évora, Portugal > > > > > > > > > [[alternative HTML version deleted]] > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee (she/her) http://www.numberwright.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] Question for R-sig-ecology
Hi, I'm not sure you even need image classification. Use list.files() to get the image filenames. Read the image into R. Discard it if the pixel values have a very low variance, indicating that they didn't detect anything (or are mostly black? depending on what your camera records when covered in snow). There are R packages such as jpg and tiff that allow you to read common image formats into R. Sarah On Mon, Jan 4, 2021 at 11:02 AM Anshika Kulshrestha wrote: > > Hello everyone, > > I have limited experience with R and have only been using it for GIS tasks. > Now I have data from camera traps which take pictures when there is some > movement and at the specific time of the day everyday. What I am planning > to with this data is rather simple, I just want my script to identify the > images where the lens was covered in snow and couldn't capture anything and > eliminate those images. I think I am not able to look for the right > material to read, since with all the research I did till now, I can only > find blur image detection which is not exactly what I am looking for. > > I would really appreciate it if anyone can help with what exactly I should > be reading to learn this. > > Thank you > > [[alternative HTML version deleted]] > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee (she/her) http://www.numberwright.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] Regarding R for community analysis
Hello, There are a number of good tutorials for the vegan package available online. This package brings together a large number of community analyses. If you’re looking for a textbook, Numerical Ecology in R, by Borcard, Gillet, and Legendre, might be a good starting point. Sarah On Sun, May 24, 2020 at 7:00 AM Harpreet Kaur wrote: > Hi > > I am new to R. I am a doctoral student from India, i need to do the > community analyses for my data using R. Is there any user friendly tutorial > available especially starting from the scratch (how to format the data > frame) to ordination and other commonly used analyses. > > Thanks > Harpreet > > [[alternative HTML version deleted]] > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology > -- Sarah Goslee (she/her) http://www.sarahgoslee.com [[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] (no subject)
Hello Omar, This doesn't seem particularly ecology-related, but I'll give you the same answer you're likely to get on any other list. R is Open Source, and has a vibrant user community. That means that the best way for you to have your code incorporated into R is to write a package, and contribute it to CRAN. If you don't want to do it yourself, you could find a collaborator to do the R portion, but a package is the only way this is likely to be included, in the near or far futures. One place to start might be to look at who has published related packages, and inquire if they would be interested in collaborating with you to add your algorithm. Best, Sarah On Tue, Dec 17, 2019 at 1:13 PM Omar Maghawry wrote: > > Hi, I am Omar Maghawry Ibrahim. I am a professor of crop science at SRTA > City, Egypt. I developed a new method to compute relative importance of > inputs in neural networks. I wrote a code in visual basic for this method > and I published it in a paper in 2013. It produces more accurate results > than Olden and Garson methods especially when inputs have negative > correlation with the output. I hope that this method to be included in R in > the near future. > kindly find the attached paper. > Best regards, > Omar > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee (she/her) http://www.numberwright.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] Producing images of Plant leaves in R
Hi Eric, I didn't look for an existing tool (you might try rseek.org) but here's a quick and dirty leaf sketch tool that might give you an idea for making your own. leaf <- function(leafheight, width10, width50, width90, origin = c(0, 0), add = TRUE, main = "Leaf sketches", scaleheight, ...) { # draws a schematic leaf based on height and three widths # if add = FALSE, creates a blank plot # places leaf base at origin point # takes additional parameters to polygon such as col # if scaleheight is missing, scales measurements so leafheight == 1 if(missing(scaleheight)) scaleheight <- leafheight width10 <- (width10 / scaleheight) / 2 width50 <- (width50 / scaleheight) / 2 width90 <- (width90 / scaleheight) / 2 leafheight <- leafheight / scaleheight maxwidth <- max(c(width10, width50, width90)) if(!add) plot(c(-maxwidth, maxwidth), c(0, 1), xaxt = "n", yaxt = "n", xlab = "", ylab = "", type = "n", main = main) x <- c(0, width10, width50, width90, 0, -width90, -width50, -width10, 0) y <- c(0, .1, .5, .9, 1, .9, .5, .1, 0) * leafheight polygon(x, y, ...) invisible() } ### leaf(50, 60, 30, 10, add = FALSE, main = "Leaf sketches") leaf(20, 5, 8, 2, scaleheight = 50, border = "green", lwd = 3) leaf(50, 2, 10, 15, scaleheight = 50, border = "red") On Tue, Jun 11, 2019 at 4:08 PM Eric Doucette wrote: > > Hello, does anyone know of a package(s) or methods to reproduce the shapes > of plant leaves in R? I have a large dataset (over 7500) of individual > plant leaves for which I have the following measurements: leaf length, leaf > width, leaf width at 1/10 of the overall length below the apex, and leaf > width at 1/10 of the overall length above the base. I am looking for a way > to code to get a visual representation of these lengths. They do not have > to actually be the same as the "real" measurements as long as the ratio of > measurements is correct. Thanks for any advice you can provide, > Eric > > [[alternative HTML version deleted]] > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee (she/her) http://www.numberwright.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] Query
Hi Bruce, There's extensive material online about spatial capabilities in R. Without being sure what you've looked at so far, do these help: https://stackoverflow.com/questions/15075361/how-to-perform-a-vector-overlay-of-two-spatialpolygonsdataframe-objects https://rspatial.org/rosu/Chapter11.html In general, you need the sp and rgeos packages. I know that the sf package also has very good capabilities for overlaying data, but I'm less familiar with its usage. Sarah On Thu, May 30, 2019 at 8:36 AM Bruce Miller wrote: > > Hi all, > > I am still searching for a way to extract associations between 2 vector > polygon layers using R. > > What I need is information on if this is possible and if so which > packages to use and a basic set of code to do what I can run in the GIS > software. > > For each iteration I have a vector polygon of a bat species distributions. > Depending on the country the number of these can range from only a > dozen to > 150 species distribution shape files. > > What I need to do is use the most current habitat/ecosystem vector > layers for each geographic area and then extract the species overlapping > values. This creates a new shape file that has added to the species > data table all values for the ecosystem where the species polygons > overlap the ecosystem polygons. This provides habitat associations for > each species. > > Then the table is exported to Excel and the data is used for Interactive > Identification Keys for New World Bat calls. > This eliminates species that do not occur in a given ecosystem as people > work on IDing their bats form acoustic surveys. > > I assume this can be accomplished using R. > > I have a new ecosystem data set of polygons for Peru, for example that > is very detailed. I extracted one species late yesterday. > It took >8 hours in the GIS to compile the areas where the species > distribution and ecosystem areas overlapped! > I would like to do this in R as a batch file and run on another computer > so not to tie up my main workstation. > > Any guidance or suggestions welcomed. > > Bruce > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee (she/her) http://www.numberwright.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] Calculate AIC, DIC and BIC for models machine learning
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]] > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee (she/her) http://www.numberwright.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] New R user
Hi Richard, Welcome to R! This email list removes attachments. Please either paste the code into your email, or post a link to it online. You’ll also get more useful and informative answers if you tell us what you’re trying to do, what you’ve attempted so far, and exactly where you’re stuck. “Explain the attached code” is a rather vague question. Sarah On Jul 27, 2018, 5:32 PM -0600, Richard Martinez , wrote: > Hi everyone, > My name is Richard and I'm an undergraduate at University of California, > Riverside. > I work in a Ecology lab and I'm interested in using this program for data > analysis. > Can anyone please explain the attached code? > ___ > 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] Distance for logistic models
Hi Daniel, Choosing a dissimilarity based on what gives you the best fit is suspect, just like any other "try everything and take the lowest p-value" approach. Better, look at the properties of the various dissimilarities and choose the one that best fits your data and your hypothesis. Also note that NMDS fits the rank order distance of the dissimilarities. Sarah On Wed, Jan 10, 2018 at 10:07 AM, Daniel Patón Domínguez <d.pato...@gmail.com> wrote: > Dear all: > > I am preparing a study using Non-Metric Multidimensional Scaling with some > acoustic parameters. The final fitting indicate a R2 of 0,99 using canberra > distance. However, the tendency of fitting between ordination distances and > observed dissimilarities show a logistic form. I had tested 12 mathematical > distances-simmilarity-disimilarity analysis but probably additional distances > not include in dist or ecodist libraries can be used. Any suggestion? > > Regards -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Dissimilarity measure for rank data
Hi Tania, That's not really an R question, and there's no one perfect answer. Googling "distance metric for ordinal data" turns up some discussions of the pros and cons of the various options. You need to choose the one best able to address your hypothesis. You might get better ideas on a statistics forum, rather than an R-specific list. Sarah On Thu, Jun 8, 2017 at 6:54 AM Tania Bird <taniab...@gmail.com> wrote: > I have species data that I would like to use for ordination. With > regular abundance data I would apply a Hellinger Transformation and > then use the Bray-Curtis distance. > > Since the data are ranked (0 to 5) I will not transform it. But what > dissimilarity measure should I use instead of Bray-Curtis? > > Thanks > > > Tania Bird MSc > "There is a sufficiency in the world for man's need but not for man's > greed" ~ Mahatma Gandhi > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology > -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.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
Re: [R-sig-eco] test for differences between effect sizes
Hi Paolo, This list isn't really for asking pure statistics questions, but for R applications in ecology. Your question is better addressed to a local stats consultant, or to stackoverflow. Sarah On Wed, Mar 22, 2017 at 2:40 PM, Paolo Piras <paolo.pi...@uniroma3.it> wrote: > Hi folks, > > I write in order to ask your opinion about the best strategy to test for > differences between two effect sizes coming, for example, from two different > one-way anovas designs that uses different independents variables while > keeping the same two-levels factor variable. For example I would like to > assess if the significant differences between two levels that I found for > two differents measures are different between them or not. I have in mind > some solutions (permuting z-scores, etc) but maybe there are already better > ad-hoc solutions. > > Thanks in advance for any advice > > Best > > paolo > > > > > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Dat input inext sample
Hi Luis, It isn't entirely clear to me where your problem lies, but it sounds like you are having difficulty importing your data into R. If that's so, then the R manual on the topic is a good place to start: https://cran.r-project.org/doc/manuals/r-release/R-data.html This manual describes, among other things, how to use read.table() to import your txt file into R. If your problem lies elsewhere, a small reproducible example would be very useful for those who might help you try to solve it. Sarah On Tue, Mar 21, 2017 at 3:29 AM, Luis Fernando García <luysgar...@gmail.com> wrote: > Dear R users, > > I am new using the package inext. I am needing to introduce a dataset which > contains the information of the species abundance in three localities. > Unfortunately the number of species per site is extremely long to do it by > "hand". I tried to create some matrixes in a txt file but it has not > worked,the package also contains examples which are short and already > arranged as lists. Therefore I wanted to know if any of you has a model > matrix or reproducible file (may be a txt or excel) which I can use as a > model. > > Many thanks for your help > > Best > -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] sending a query with a graphic
Hello all, Several useful suggestions have already been provided, but just for clarification: This list, like all the R-sig lists, follows the R mailing list guidelines available at: https://www.r-project.org/mail.html Most binary files are stripped, but small PNG files are allowed, as are PS and PDF. Please also post in plain text rather than HTML. Sarah, list owner On Mon, Feb 27, 2017 at 5:02 AM, Tania Bird <taniab...@gmail.com> wrote: > Hi all, > > I just tried to post my first posting requesting help with some > multivariate statistics to this mailing list, but I got an email saying it > was rejected because it has a graphic.. I think the graphic is important to > explain my question- > Are we allowed to post small gif or jpeg images to aid the questions? What > format can I use to attach or embed some low resolution format? > > Many thanks for your advice > > > Tania Bird MSc > *PhD Student* > *Geo-Ecology Lab* > *Ben Gurion University* > > [[alternative HTML version deleted]] > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] (no subject)
You can unsubscribe yourself at the link in the footer of every message to this list: https://stat.ethz.ch/mailman/listinfo/r-sig-ecology If you are having trouble getting help on this list, though, you might benefit from taking a look at the general R-help list information, including the general R-help posting guide, for how to formulate a question that people can answer. https://www.r-project.org/mail.html#instructions https://www.r-project.org/posting-guide.html Sarah On Mon, Dec 12, 2016 at 12:05 PM, Vitor <vitoraraujo.biol...@gmail.com> wrote: > Nobody answer me when I ask something, but I always answer your question. > Could u please take off my name of this email? > > [[alternative HTML version deleted]] For instance, not posting in HTML would help, as HTML makes questions very hard to follow. > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Errors with Simprof for cluster significance
I can't duplicate your error. Assuming the attached document describes your data, it works fine. I changed the code to use braycurtis instead of euclidean, as you wanted, and it does return a warning, just as the help file documents. So you'll need to provide more information. data<- structure(list(necsur = c(1L, 4L, 0L, 8L, 0L, 1L), necame = c(4L, 5L, 9L, 9L, 4L, 7L), niccar = c(1L, 1L, 1L, 2L, 1L, 4L), nicorb = c(2L, 20L, 23L, 26L, 3L, 12L), nicpus = c(0L, 0L, 1L, 0L, 0L, 0L), nictor = c(0L, 2L, 1L, 3L, 2L, 1L), delgib = c(10L, 31L, 47L, 48L, 15L, 55L), cancha = c(5L, 6L, 4L, 4L, 1L, 6L), melbis = c(3L, 0L, 1L, 3L, 0L, 1L), atelec = c(4L, 6L, 28L, 22L, 8L, 52L), copmin = c(0L, 0L, 1L, 1L, 0L, 1L), ontcon = c(3L, 3L, 11L, 7L, 1L, 2L), ontdep = c(2L, 0L, 0L, 0L, 0L, 0L), onthec = c(17L, 15L, 9L, 6L, 6L, 2L), ontstr = c(0L, 0L, 0L, 1L, 1L, 0L), onttau = c(20L, 13L, 6L, 2L, 0L, 2L), ontpen = c(2L, 3L, 5L, 3L, 2L, 4L), onttub = c(2L, 3L, 4L, 1L, 1L, 0L), phavin = c(1L, 0L, 0L, 0L, 0L, 1L), Phyili = c(0L, 0L, 0L, 0L, 0L, 1L), canvir = c(0L, 1L, 0L, 0L, 0L, 0L), hybill = c(1L, 0L, 0L, 0L, 0L, 0L), cyclev = c(0L, 0L, 0L, 0L, 1L, 1L), galjan = c(0L, 0L, 1L, 1L, 0L, 0L), cyclosig = c(0L, 0L, 0L, 0L, 1L, 0L), omomon = c(1L, 2L, 4L, 10L, 1L, 6L), trofov = c(1L, 2L, 3L, 1L, 0L, 1L), trouni = c(1L, 0L, 0L, 1L, 0L, 0L), troter = c(0L, 1L, 1L, 0L, 0L, 0L), eusass = c(9L, 8L, 23L, 14L, 11L, 28L), hiscoe = c(2L, 1L, 10L, 4L, 2L, 4L), hisabb = c(0L, 0L, 0L, 0L, 2L, 0L), cremax = c(4L, 7L, 1L, 2L, 2L, 5L), plamac = c(1L, 0L, 3L, 2L, 2L, 2L), plafem = c(0L, 0L, 0L, 0L, 0L, 0L), plafos = c(1L, 1L, 3L, 2L, 1L, 2L), placom = c(6L, 3L, 3L, 10L, 13L, 7L), tacfim = c(0L, 0L, 1L, 0L, 0L, 0L)), .Names = c("necsur", "necame", "niccar", "nicorb", "nicpus", "nictor", "delgib", "cancha", "melbis", "atelec", "copmin", "ontcon", "ontdep", "onthec", "ontstr", "onttau", "ontpen", "onttub", "phavin", "Phyili", "canvir", "hybill", "cyclev", "galjan", "cyclosig", "omomon", "trofov", "trouni", "troter", "eusass", "hiscoe", "hisabb", "cremax", "plamac", "plafem", "plafos", "placom", "tacfim"), row.names = c("AP-0", "AP-100", "AP-200", "AP-300", "ST-0", "ST-100"), class = "data.frame") > simprof(data, num.expected=1000, num.simulated=999, + method.cluster="average", method.distance="braycurtis", + method.transform="identity", alpha=0.05, + sample.orientation="row", const=0, + silent=TRUE, increment=100, + undef.zero=TRUE, warn.braycurtis=TRUE) $numgroups [1] 2 $pval [,1] [,2][,3] [1,] -3 -4 NA [2,] -61 0.461461461 [3,] -1 -2 NA [4,] -53 0.905905906 [5,]24 0.003003003 $hclust Call: hclust(d = rawdata.dist, method = method.cluster) Cluster method : average Number of objects: 6 $significantclusters $significantclusters[[1]] [1] "ST-100" "AP-200" "AP-300" $significantclusters[[2]] [1] "ST-0" "AP-0" "AP-100" Warning messages: 1: This version of the Bray-Curtis index does not use standardization. 2: To use the standardized version, use "actual-braycurtis". 3: See the help documentation for more information. On Thu, Oct 6, 2016 at 8:43 PM, Ansley Silvawrote: > Hello all, > > I'm using R version 3.3.1, clustsig package. > > I have a community dataset and I originally used hclust in the vegan > package to get dendrograms, however I need significance on the groups that > were formed. I'd really like to use SIMPROF to look for significance among > the groups, but I am running into errors. > > > These are the errors I get: > >> simprof(apst, num.expected=1000, num.simulated=999, > method.cluster="average", method.distance="braycurtis", alpha=0.05, > sample.orientation = "column", const = 0, silent = TRUE,increment=100) > > Error: argument "undef.zero" is missing, with no default > In addition: Warning messages: > 1: This version of the Bray-Curtis index does not use standardization. > 2: To use the standardized version, use "actual-braycurtis". > 3: See the help documentation for more information. > >> simprof(apst, num.expected=1000, num.simulated=999, > method.cluster="average", method.distance="actual-braycurtis", alpha=0.05, > sample.orientation = "column", const = 0, silent = TRUE,increment=100) > > Error in if (denom != 0) { : missing value where TRUE/FALSE needed > >> simprof(apst, num.expected=1000, num.simulated=999, > method.cluster="average", method.distance="braycurtis", alpha=0.05, > sample.orientation = "column", const = 0, silent = TRUE,increment=100) > > Error: argument "undef.zero" is missing, with no default > In addition: Warning messages: > 1: This version of the Bray-Curtis index does not use standardization. > 2: To use the standardized version, use "actual-braycurtis". > 3: See the help documentation for more information. > >> simprof(apst, num.expected=1000, num.simulated=999, > method.cluster="average", >
Re: [R-sig-eco] Unsubscribe me. Please!
You can manage your own subscription at the same place you signed up: https://stat.ethz.ch/mailman/listinfo/r-sig-ecology Directions are provided there, along with the email address to contact if you continue to have trouble. Sarah On Friday, October 7, 2016, Marek Šlenker <m.slen...@gmail.com> wrote: > thx > > [[alternative HTML version deleted]] > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org <javascript:;> > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology > -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.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
Re: [R-sig-eco] Graphically represent Mantel Test
I'm not sure what you're asking: a Mantel test result is a single number. Path diagrams are one potential tool for displaying the results of many such tests. You might also be interested in Mantel correlograms, for spatial pattern. This isn't an R question, as presented, but I'm curious what you mean. Sarah On Fri, Mar 18, 2016 at 7:22 AM, Javier Martínez-Lópezwrote: > Hello all, > > is there a way of graphically represent a Mantel correlation test between > two distance/dissimilarity matrices? > > Thank you and best regards, > > Javier > ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Graphically represent Mantel Test
Of course you can plot the distance vs the environmental matrix. That's a reasonable thing to do, just as you would do it for any potentially-correlated data. Sarah On Fri, Mar 18, 2016 at 9:19 AM, Javier Martínez-López <javi.martinez.lo...@gmail.com> wrote: > I guess what I try to show is something like plotting an axis of an NMDS > based on each multivariate distance matrix against each other. I have an > environmental versus a species distance matrix, with a high correlation > based on the Mantel test and I wanted to show it somehow graphically. I will > take a look at path diagrams. Thanks! > > On Fri, Mar 18, 2016 at 2:09 PM, Sarah Goslee <sarah.gos...@gmail.com> > wrote: >> >> I'm not sure what you're asking: a Mantel test result is a single number. >> >> Path diagrams are one potential tool for displaying the results of >> many such tests. >> >> You might also be interested in Mantel correlograms, for spatial pattern. >> >> This isn't an R question, as presented, but I'm curious what you mean. >> >> Sarah >> >> On Fri, Mar 18, 2016 at 7:22 AM, Javier Martínez-López >> <javi.martinez.lo...@gmail.com> wrote: >> > Hello all, >> > >> > is there a way of graphically represent a Mantel correlation test >> > between >> > two distance/dissimilarity matrices? >> > >> > Thank you and best regards, >> > >> > Javier >> > > > ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] GLMM with spatial coordinates
Hi Jhonny, As you can see below, posting in HTML means that your message becomes impossible to read. Your second example matrix is at least readable, but not really helpful Using dput() is much better for providing R data. It looks like the spaMM package provides spatial GLMM. Have you looked into that yet? This list really isn't equipped to assist you with basic statistical questions, but we can help with specific ecological R questions. Sarah On Thu, Mar 10, 2016 at 11:29 AM, Jhonny Capichoni Massante <jcmassa...@hotmail.com> wrote: > Dear all, > > My name is Jhonny and I'm finishing my master with plant ecology. > I need some help with my data because I want to analysis with GLMM and to > include spatial coordinates, but I don't know to do it! Someone help me? > I have a data.frame with 200 obs. of 45 variables. This data.frame is in > block as example below: > > > > > > > > > > > > Plot > Bock > Cod > Lat > Long > Area > Elev (m) > Baresoil > > Litter > > Vneo > Cova > Aren > Mfum... > > > 1 > > 1 > > M8400 > Gg°mm'ss.s" s > Gg°mm'ss.s" w > 2.47275 > 8 >0 > > 0 > > 0.2 > > 0.69 > > 0.05 > > 0.02 > > > > 2 > > 1 > > C8400 > Gg°mm'ss.s" s > Gg°mm'ss.s" w > 1 > 8 > 0.35 > > 0.2 > > 0 > > 0.1 > > 0.2 > > 0.05 > > > > 3 > > 2 > > M8340 > Gg°mm'ss.s" s > Gg°mm'ss.s" w > 2.190386 > 9 > 0.03 > > 0.13 > > 0 > > 0 > >0 > > 0 > > > > 4 > > 2 > > C8340 > Gg°mm'ss.s" s > Gg°mm'ss.s" w > 1 > 9 > 0.7 > > 0.01 > > 0 > > 0 > > 0 > > 0.15 > > > > > . > . > . > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >From Vneo (in blue) are my plant species with its cover (from 0.00 to 1.00) > >and between Lat and Litter are my predictor variables. Before Lat are plot > >number, block (paired) number and plot code. > > I want to know if predictor variables (or its interactions) explain the > co-ocurrence of plants at scrub vegetation surrounding by baresoil and to > know if is there spatial autocorrelation. The lat and long are position of > plots and they make up a gradient of distance from a source of stress > (hypersaline coastal lagoon). > > How can I begin this analisys? > > Thank you so much! > Best wishes!!! > > Jhonny > Capichoni Massante > Universidade > Federal Fluminense - UFF > > > > [[alternative HTML version deleted]] > > > ___ > R-sig-ecology mailing list > R-sig-ecology@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[R-sig-eco] Job opportunity for a statistician at UFZ (Germany)
Posted on behalf of Ingolf Kühn: -- Dear colleagues, we offer a full-time position on "Statistical Consulting, Teaching and Coordination" at the Helmholtz Centre for Environmental Research - UFZ. For further details, please see: https://recruitingapp-5128.de.umantis.com/Vacancies/623/Description/2 The position is initially limited to two years, with tenure option. If you have further questions, please do not respond to me but to the head of the UFZ graduate school HIGRADE Dr. Jula Zimmermann. Best regards Ingolf -- Prof. Dr. Ingolf Kühn (Professor for Macroecology at the Martin-Luther University Halle-Wittenberg) Dept. Community Ecology Helmholtz-Zentrum für Umweltforschung GmbH - UFZ/ Helmholtz Centre for Environmental Research GmbH - UFZ Theodor-Lieser-Str. 4 / 06120 Halle / Germany Sitz der Gesellschaft: Leipzig Registergericht: Amtsgericht Leipzig, Handelsregister Nr. B 4703 Vorsitzender des Aufsichtsrats: MinDirig Wilfried Kraus Wissenschaftlicher Geschäftsführer: Prof. Dr. Georg Teutsch Administrativer Geschäftsführer: Dr. Heike Graßmann ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] hello group
Hi Moses, On Sat, Sep 26, 2015 at 8:25 AM, moses duguru <dugur...@yahoo.co.uk> wrote: > Are there any users of "rclimdex" in this group, I will be glad to get > responses from users before I ask my questions. Questions like this are not a good use of everyone's time. If you have a very specific rclimdex question, the package maintainer is the person to ask. Otherwise, posting your full question here, with ideally a reproducible example, is the way to go. This list has many subscribers; someone is likely to be able to help you if you post a useful question. Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Independence of vegetation samples
Hi Mike, On Thu, Sep 3, 2015 at 11:01 AM, Michael Marsh <sw...@blarg.net> wrote: > Is there a method in R for testing for independence of vegetation samples, > for example because of relative proximity of different samples? I would like > to treat the 3 radially arranged transects of Jornada Line Point Index plots > as different sample units. > Mike Marsh > Washington Native Plant Society You can look at the scale of spatial autocorrelation in the data, but really? I can't imagine how the LPI transects at a single point could be considered independent. Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ 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 message in package FD, function dbFD ()
I *think* your problem is contained in the help for ?FD, where it says that for a, rows are sites and species are columns. But you posted in HTML, and didn't use dput() to provide data, so your example is hopelessly mangled. Without a reproducible example that includes some sample data (fake is fine), the code you used, and some clear idea of what output you expect, it's impossible to figure out exactly how to help you. Here are some suggestions for creating a good reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Sarah On Wed, Jul 15, 2015 at 9:35 AM, Laura Riggi laura.ri...@slu.se wrote: Dear R community, I have some trouble with the dbFD function in the FD package. str(a) 'data.frame':150 obs. of 48 variables: str(x) 'data.frame':48 obs. of 9 variables: ex1 - dbFD(x,a) Error in dbFD(x, a) : Species labels in 'x' and 'a' need to be identical and ordered alphabetically (or simply in the same order). I have checked multiple time the data set but this message keeps on appearing. The names of the species are identical in both data.frames. I was wondering if you could help me by giving me an example of an excel trait and species matrix table to upload for this package. Below is a snapshop of my data. I have also checked that there are no NA's problems and that there is no species abundance = 0 or no community with 0 species. Thank you for any advice! Best Laura Species table (a) Agonum_assimile Agonum_dorsale Agonum_gracile Agonum_gracilipes 2 3 0 0 0 6 0 0 1 10 0 0 1 5 0 0 0 8 0 0 2 7 0 0 1 6 0 0 Trait table(x) Species SizeCategoy Ecology Reproduction Diet Wing Agonum_assimile C nocturnal spring Carnivorous Brachypterous Agonum_dorsale B nocturnal spring Carnivorous Macropterous Agonum_gracile B diurnal spring Carnivorous Macropterous Agonum_gracilipes B both spring Carnivorous Macropterous [[alternative HTML version deleted]] ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] multipart
Please provide a reproducible example including sample data and the code you've already tried. Without a reproducible example that includes some sample data (fake is fine), the code you used, and some clear idea of what output you expect, it's impossible to figure out how to help you. Here are some suggestions for creating a good reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Sarah On Tue, Apr 7, 2015 at 11:04 AM, Merdas Saifi saifi...@gmail.com wrote: Hello, I'm trying to perform Multiplicative Diversity Partitioning with multipart function in R, i've 30 transects with frequency or presence absence data, 15 of them are grazed and 15 are protected, each 03 transects forms a site, so i want to analyse beta diversity at multiple spatial scales to quantify among-transects and among-sites. Many thanks, Saifi -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Plot NMDS with size of the points related to abundance
Hi Barbara, You don't provide a reproducible example or even tell us what package/function you used to create your NMDS ordination, but you can extract the coordinates, and use them plus your cover values to create a bubble plot in several different ways, including symbols(), the pch argument to base plotting functions, and ggplot(). There's a nice tutorial for one method here: http://flowingdata.com/2010/11/23/how-to-make-bubble-charts/ but searching for bubble plot in R will get you many more options. Sarah On Tue, Mar 17, 2015 at 11:23 AM, Barbara Baraibar Padro bu...@psu.edu wrote: Hello list, I am analyzing species composition of weeds in 12 cover crop treatments and a fallow plot. I have been using nmds and got good results and no problems with it (although after some fighting!). My data is a matrix of biomass values sorted by species. Now I'd like to know which of my species are contributing with more biomass to the community in each treatment, that is, I'd like to create a graph such as the one that you get from the option plot (nmds_model, type=t, display=c(species)) but instead of getting just the names of the species, I'd like to see dots of different sizes that would refer to the abundance of each of the species, is that possible at all? I know you can do it with CANOCO but wanted to ask if there is a way to do it in R. I have searched the internet and found something that looks like what I want to do (enclosed to the mail) but haven't found the way to do it. I have already done an Indicator Species Analysis with the multipatt function. That gives me information about the species that are related to some treatments but here I'm just looking for the species with more and less biomass in each treatment. Thank you very much!! Barbara -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Anderson and Willis 2003, CAP squared canonical correlations of delta^2
Hi Thomas, You're more likely to get help if you include context in your post. Nabble is NOT an official part of this mailing list, and most people receive the list via email, and thus have no idea what you're referring to. If you check out http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example you might get some ideas on how to rephrase your question so as to get someone to volunteer assistance. Sarah On Mon, Feb 16, 2015 at 5:44 AM, thomas.rime thomas.r...@wsl.ch wrote: Hi all, I know this is an old post but I'm facing the same problem now. Since this thread stops at this point, I thought it would help some of us to go a step further. :) Can anyone help me to find the values below used to calculate the squared canonical correlations? 0.78101^2 [1] 0.6099766 0.69142^2 [1] 0.4780616 The dune.cap$manova$Eigenvalues values do not resemble those... so I was wondering where they come from. I also examined the other results given by the CAP analysis but couldn't find something that would be close to these values... Any help would be really appreciated! Thanks Thomas -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] What package and steps needed to emulate legacy NTSYS ?
That sounds simply like a job for the base hclust() function. The help for that function has a worked example. But Euclidean distance is probably the wrong choice for mixed binary and continuous variables. I'd suggest looking into other options, like maybe Gower, and also rethinking whether both types of variables should be in the same analysis. Sarah On Sun, Dec 14, 2014 at 6:52 AM, Bruce Miller batsnc...@gmail.com wrote: Hi all, Especially Jari There are now a lot of clustering algorithm packages in R. What would be the most usable package to run similar analyses as the older NTSYSpc? I was able to dig through an older backup image of one of my hard drives and resurrected NTSYSpc v. 2.11 but would prefer to set up similar analyses in R. To have similar results the starting matrix data frame would be OTUs (critters) as rows and the columns are values of things needing to be compared. These are comprised of both 1/0 data for locations and continuous variables for measurement data (critter sizes and in this case echolocation call parameters). Running NTSYSpc the initial data matrix may or may not first be standardized. Then a similarity coefficients are computed to generate a new matrix which is used as input for a clustering SAHN (UPGMA using Euclidean distance) then graphically the tree is displayed (GGPLOT2?) I am sure there is a way to do this, but have not found vignettes for the various R packages to explain code to set this up. Thanks for any suggestions. Bruce -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Distance matrix analyses
Test them for what? If you can formulate your hypotheses more clearly, you might try the model matrix approach outlined in Legendre, P. and M.-J. Fortin. 1989. Spatial pattern and ecological analysis. Vegetatio, 80: 107-138. and subsequent references. But there might be better ways, depending on what you are trying to achieve. Sarah On Thu, Sep 18, 2014 at 11:17 AM, Diego Javier Inclan Luna diegojavier.inclanl...@studenti.unipd.it wrote: Hi, I would like to test dissimilarities among different groups in a dist matrix. For instance, if I have a dist matrix with three factors a, b, c, functions like adonis and betadisper in vegan will test the aa, bb and cc combinations. However, I am interested in testing the ba, ca, and cb combinations. How I could test for these combinations? *a a a b b b c c c* *a* aa *a* aa aa *a* aa aa aa *b* ba ba ba bb *b* ba ba ba bb bb *b* ba ba ba bb bb bb *c* ca ca ca cb cb cb cc *c* ca ca ca cb cb cb cc cc *c* ca ca ca cb cb cb cc cc cc Thanks! -- -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Manova and DFA analysis
Hi, Those aren't really R questions, nor are they questions we can answer without a great deal more information. Your very best course would be to set up an appointment with a local statistician who can help you. If that isn't an option for you, a statistics forum would be a better place to ask. Sarah On Wed, Sep 3, 2014 at 7:10 AM, Mohammed Almalki m11m...@hotmail.com wrote: Dear all, I am new user for R program and I am looking for somebody to help me with Manova and discriminant function analysis DFA . I have four measurement traits for bird species (weight, wing length, tarsus length and bill length) and I would like to test for differences in body size between males and females of this species. FIRST, I applied MANOVA using (weight, wing length, tarsus length and bill length) as dependent variables and sex as an independent variable. In order to identify the significance of sex differences for each dependent variable using this form: rm data1-read.csv(C:/Users/Desktop/CP/CP_NOMISS.csv) names (data1) attached(data1) head(data1) manova1 - manova (cbind (Weight, Wing.Length, Tarsus.Length, Bill.Length)~ as.factor (Sex), data=data1) summary (manova1) summary.aov(manova1) After that I got four tables (one table for each variable) My questions are: 1. Is what I did correct and enough to get Manova results? 2. what is the most important result can describe the difference is it F value or Pr(F) value 2. How I can describe the results in figure? SECOND, I applied discriminant function analysis (DFA) on the four morphological characters using the package MASS in order to identify the variable that differed most between males and females using this form: rm library (MASS) data1-read.csv(C:/Users/Desktop/CP/CP_NOMISS.csv) head(data1) attach (data1) data1 plot(data1[ ,c(2,3,4,5)], col=data1[ ,1]) data1.lda - lda(SEX~WG + WL + TL + BL, data=data1) data1.lda After that I got this result: Coefficients of linear discriminants: LD1 WG -0.001040297 WL -0.011554912 TL 0.030233583 BL 0.498226667 1.Is what I did enough to say the variable that differed most between males and females is BL 0.498. And does this difference is reliable? OR there are other steps I have to do. Please excuse the long email. Thank you very much in advance for any help you can provide. Best regards,Mohammed -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Missing Data
Hi, First, go to http://www.rseek.org and search for imputation. After you've read about the large variety of options available in R and thought about which might be suitable for your data (which we know nothing about), then you could try returning to this list for help with specific R questions. Sarah On Tue, Aug 26, 2014 at 10:56 AM, Mohammed Almalki m11m...@hotmail.com wrote: Dear all, I am looking for somebody help me with missing data.I have data contains some missing values and I would like to estimate these values. Could you please tell me how to estimate the missing value using R. Many thanks,Mohammed -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] how to detect different species among samples
Hi Gian, I don't understand what you're trying to do. Can you give a simple example of your data and what your results should be? Sarah On Saturday, February 1, 2014, Gian Maria Niccolò Benucci gian.benu...@gmail.com wrote: Hi all R-sig-ecologists, Sorry for the very simple and probably stupid question. I was wandering if exist a simple method or a function in R, to detect which different species are present among the samples of a given data community matrix. Thanks a lot in advance, -- Gian -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.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
Re: [R-sig-eco] Community composition variance partitioning?
Hi, That seems a bit odd: can you provide a reproducible example, off-list if necessary? Sarah On Wed, Dec 4, 2013 at 12:50 PM, Alexandre Fadigas de Souza alexso...@cb.ufrn.br wrote: Dear friends, My name is Alexandre and I am trying to analyze a dataset on floristic composition of tropical coastal vegetation by means of variance partition, according to the outlines of a Tuomisto's recent papers, specially Tuomisto, H., Ruokolainen, L., Ruokolainen, K., 2012. Modelling niche and neutral dynamics : on the ecological interpretation of variation partitioning results. Ecography (Cop.). 35, 961–971. I have a doubt, could you please give your opinion on it? We are proceeding a variance partition of the bray-curtis floristic distance using as explanatory fractions soil nutrition, topography, canopy openess and geographical distances (all as euclidean distance matrices). We are using the MRM function of the ecodist package: mrm - MRM(dist(species) ~ dist(soil) + dist(topograph) + dist(light) + dist(xy), data=my.data, nperm=1 The idea is that the overall R2 of this multiple regression should be used to assess the contributions of the spatial and environmental fractions through subtraction : Three separate multiple regression analyses are needed to assess the relative explanatory power of geographical and environmental distances. All of these have the same response variable (the compositional dissimilarity matrix), but each analysis uses a diff erent set of the explanatory variables. In these analyses the explanatory variables are: (I) the geographical distance matrix only, (II) the environmental diff erence matrices only, and (III) all the explanatory variables used in (I) or (II). Comparing the R 2 values from these three analyses allows partitioning the variance of the response dissimilarity matrix to four fractions. Fraction A is explained uniquely by the environmental diff erence matrices and equals R2 (III) R2 (I). Fraction B is explained jointly by the environmental and geographical distances and equals R2 (I) R2 (II) R2 (III). Fraction C is explained uniquely by geographical distances and equals R2 (III) R2 (II). Fraction D is unexplained by the available environmental and geographical dissimilarity matrices and equals 100% R2 (III) (throughout the present paper, R2 values are expressed as percentages rather than proportions). [Tuomisto et al. 2012] The problem is that the R2 of the overall model (containing all the explanatory variables) is smaller than most of the R2 of models containing each of the explanatory matrices. So it seems not possible to proceed with the approach proposed. Sincerely, Alexandre Dr. Alexandre F. Souza Professor Adjunto II Departamento de Botanica, Ecologia e Zoologia Universidade Federal do Rio Grande do Norte (UFRN) http://www.docente.ufrn.br/alexsouza Curriculo: lattes.cnpq.br/7844758818522706 ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org ___ 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 message using getverticeshr() to extract home-range contours
Hi Dylann, All we can possibly tell you is that the index is out of range. That's the kind of problem that really needs a reproducible example for anyone to be able to give you useful advice. Here's some advice on doing so: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Sarah On Thu, Nov 7, 2013 at 10:23 AM, Dylann Kersusan kersusan.dyl...@gmail.com wrote: Dear list, I am running a script on my computer to estimate kernelUDs for several individuals and several years (from GPS relocations). I am using the getverticeshr() function to extract home range contours, and for some reasons I end up having this error message: Erreur dans re[[i]] : indice hors limites in french, the english translation would be: Error in re [[i]]: index out of range -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] add mean, SE and SD lines to a non-linear regression
Hi, On Wednesday, September 11, 2013, Stas Malavin wrote: Hi Luis, Does this do what you want? SD - aggregate(Eaten, by = list(Density), FUN = sd) AV - aggregate(Eaten, by = list(Density), FUN = mean) newyv - predict(model, list(Density = SD[,1])) # mean points: points(SD[,1], AV[,2], pch = 19) # sd: arrows(x0 = SD[,1], y0 = newyv, x1 = SD[,1], y1 = newyv + SD[,2], angle = 90) arrows(x0 = SD[,1], y0 = newyv, x1 = SD[,1], y1 = newyv - SD[,2], angle = 90) There's also an error bar function in the Hmisc package that simplifies the process. For customizing the view see ?points and ?arrows BTW, pch=as.numeric(Prey)) is meaningless Unless Prey is a factor, then it will give sequential plotting characters according to the factor levels. Sarah Hope this helps, Stas On Wed, Sep 11, 2013 at 5:50 AM, Luis Fernando García luysgar...@gmail.com javascript:;wrote: Hello R friends, I have a serious issue on R. I have some data about the functional response of a spider, over some prey, I am really needing to plot the data and add mean and SD and or SE bars to the graph but I have not found out how to do it! Does some of you have some idea about how to do it? Here it goes my data and what I have done (data table is attached) lycosa=read.table(C:\\Users\\Luis Fernando Garcia\\R\\RFlycosa.txt,header=T) attach(lycosa) model-nls(Eaten~SSmicmen(Density,a,b)) plot(Density,Eaten,pch=as.numeric(Prey)) xv-seq(0,10,1) yv-predict(model,list(Density=xv)) lines(xv,yv) please, if somebody knows how to do this I would be very thanked! I would like my data could look like the figure 8 of this paper. http://www.sciencedirect.com/science/article/pii/S1382668913001312 All the best! ]] -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.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
Re: [R-sig-eco] Temporal clustering of factors
Hi Chris, I have 50 sites where information was recorded over a 45 year time period. The recorded data could take one of four forms: Fishing effort, Environmental, Both or Inconclusive. What i am aiming to do is cluster sites based on their similarity through time, essentially i view this as being similar to making a phylogeny, where instead of a genetic sequence i have a sequence of factors. I was thinking of using Gower distance to create a dissimilarity matrix and go from there but i don't think this captures what i am looking for? Why not? What are you looking for? Have you looked into change vector analysis or other multivariate time series methods? Though if this is representative, you don't have much information, only four categories of a single factor: why not just plot them? Please don't cross-post or post multiple times. If you don't get an instantaneous response, then the volunteers who answer questions might be busy, or your question might be poorly formed or vague. Give the list some time, at least a day, to get caught up. Sarah Any suggestions would be gratefully received. For space i have restricted the sample data to 4 sites temporal_sites - structure(list(Year = c(1959L, 1960L, 1961L, 1962L, 1963L, 1964L, 1965L, 1966L, 1967L, 1968L, 1969L, 1970L, 1971L, 1972L, 1973L, 1974L, 1975L, 1976L, 1977L, 1978L, 1979L, 1980L, 1981L, 1982L, 1983L, 1984L, 1985L, 1986L, 1987L, 1988L, 1989L, 1990L, 1991L, 1992L, 1993L, 1994L, 1995L, 1996L, 1997L, 1998L, 1999L, 2000L, 2001L, 2002L, 2003L, 2004L, 1959L, 1960L, 1961L, 1962L, 1963L, 1964L, 1965L, 1966L, 1967L, 1968L, 1969L, 1970L, 1971L, 1972L, 1973L, 1974L, 1975L, 1976L, 1977L, 1978L, 1979L, 1980L, 1981L, 1982L, 1983L, 1984L, 1985L, 1986L, 1987L, 1988L, 1989L, 1990L, 1991L, 1992L, 1993L, 1994L, 1995L, 1996L, 1997L, 1998L, 1999L, 2000L, 2001L, 2002L, 2003L, 2004L, 1959L, 1960L, 1961L, 1962L, 1963L, 1964L, 1965L, 1966L, 1967L, 1968L, 1969L, 1970L, 1971L, 1972L, 1973L, 1974L, 1975L, 1976L, 1977L, 1978L, 1979L, 1980L, 1981L, 1982L, 1983L, 1984L, 1985L, 1986L, 1987L, 1988L, 1989L, 1990L, 1991L, 1992L, 1993L, 1994L, 1995L, 1996L, 1997L, 1998L, 1999L, 2000L, 2001L, 2002L, 2003L, 2004L, 1959L, 1960L, 1961L, 1962L, 1963L, 1964L, 1965L, 1966L, 1967L, 1968L, 1969L, 1970L, 1971L, 1972L, 1973L, 1974L, 1975L, 1976L, 1977L, 1978L, 1979L, 1980L, 1981L, 1982L, 1983L, 1984L, 1985L, 1986L, 1987L, 1988L, 1989L, 1990L, 1991L, 1992L, 1993L, 1994L, 1995L, 1996L, 1997L, 1998L, 1999L, 2000L, 2001L, 2002L, 2003L, 2004L), Site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c(A, B, C, D), class = factor), Factor = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c(Both, Environmental, Fishing Effort), class = factor)), .Names = c(Year, Site, Factor), class = data.frame, row.names = c(NA, -184L )) -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Heat Map for species - code from Numerical Ecology with R
Hi Valerie, Did the suggestions given on the R-help list fail to work? You do need to provide you abundance data as one character, as specified in ?vegemite which also gives suggestions for conversion. Sarah On Tuesday, July 23, 2013, Valerie Mucciarelli wrote: Hello, I am relatively new to R and I am working through the code that is provided in the book Numerical Ecology with R: http://xa.yimg.com/kq/groups/19243105/1919134110/name/Numerical.pdf (pg 79) and I have run across an error message that I can't seem to figure out. I am using the vegan, ade4, gclus and cluster packages. The code is as follows: # Ordered community table # Species are ordered by their weighted averages on site scores or - vegemite(spe, spe.chwo) spe is the dataframe, here is part of it: AGA ANT BON CAL1 CAL CER CRY DES EUTH FRY 1 0.420 0.092 0.051 0.000 0.975 0.000 0.111 0.000 0.127 0 2 0.000 0.000 0.007 0.002 0.915 0.000 0.000 0.000 0.151 0 4 0.000 0.008 0.000 0.009 0.124 0.003 0.000 0.000 0.095 0 7 0.000 0.002 0.003 0.002 0.121 0.002 0.000 3.573 0.180 0 12 0.000 0.020 0.000 0.002 0.444 0.001 0.000 0.000 0.242 0 13 8.727 0.000 0.000 0.000 0.743 0.000 0.000 0.000 0.050 0 14 2.163 0.009 0.000 0.003 1.121 0.000 0.000 0.000 0.051 0 15 0.000 0.004 0.000 0.000 0.109 0.000 0.000 0.000 0.007 0 18 9.021 0.018 0.002 0.000 0.286 0.000 0.000 0.000 0.028 0 19 0.000 0.038 0.000 0.019 0.509 0.000 0.000 0.000 0.155 0 spe.chwo came from: spe.norm - decostand(spe, normalize) spe.ch - vegdist(spe.norm, euc) spe.ch.UPGMA - hclust(spe.ch, method = average) spe.chwo - reorder.hclust(spe.ch.UPGMA, spe.ch) and the error is: Error in vegemite(spe, spe.chwo) : Cowardly refusing to use longer than 1 char symbols: Use scale The data in the dataframe is biomass data recorded to 4 digits. I'm wondering if this code is not working because my data is more than one digit long. Any suggestions or insight on how to get this code to work would be greatly appreciated. Thank you, Val -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.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
Re: [R-sig-eco] Heat Map for species - code from Numerical Ecology with R
I am very sorry, François - I did not follow the link that was included in my reply, and did not realize it was an illegal copy. As an author myself, I'm very aware of intellectual property and piracy issues, and would never knowingly do such a thing. (Though I note that you just sent it to the list again in your reply - remembering to delete illegal links is difficult.) The default inclusion of links in email replies is something I haven't paid much attention to; I will try to do so in the future. Meanwhile, as a R-sig-ecology list owner, let me see whether I can do something to eliminate the link without deleting the whole discussion. On Wed, Jul 24, 2013 at 9:16 AM, François Gillet francois.gil...@univ-fcomte.fr wrote: Valerie and Sarah, Thank you for encouraging piracy by posting the URL of an illegal PDF of our book :-( By the way, just look at ?vegemite and you'll find easily the solution to your problem: with the argument scale=log your numeric data will be converted to 1-char symbols. François --- Prof. François Gillet Université de Franche-Comté - CNRS UMR 6249 Chrono-environnement UFR Sciences et Techniques 16, Route de Gray F-25030 Besançon cedex France http://chrono-environnement.univ-fcomte.fr/ http://chrono-environnement.univ-fcomte.fr/spip.php?article530 Phone: +33 (0)3 81 66 62 81 iPhone: +33 (0)7 88 37 07 76 Location: La Bouloie, Bât. Propédeutique, -114L --- Editor of Plant Ecology and Evolution http://www.plecevo.eu --- 2013/7/24 Sarah Goslee sarah.gos...@gmail.com Hi Valerie, Did the suggestions given on the R-help list fail to work? You do need to provide you abundance data as one character, as specified in ?vegemite which also gives suggestions for conversion. Sarah On Tuesday, July 23, 2013, Valerie Mucciarelli wrote: Hello, I am relatively new to R and I am working through the code that is provided in the book Numerical Ecology with R: X (pg 79) and I have run across an error message that I can't seem to figure out. I am using the vegan, ade4, gclus and cluster packages. The code is as follows: # Ordered community table # Species are ordered by their weighted averages on site scores or - vegemite(spe, spe.chwo) spe is the dataframe, here is part of it: AGA ANT BON CAL1 CAL CER CRY DES EUTH FRY 1 0.420 0.092 0.051 0.000 0.975 0.000 0.111 0.000 0.127 0 2 0.000 0.000 0.007 0.002 0.915 0.000 0.000 0.000 0.151 0 4 0.000 0.008 0.000 0.009 0.124 0.003 0.000 0.000 0.095 0 7 0.000 0.002 0.003 0.002 0.121 0.002 0.000 3.573 0.180 0 12 0.000 0.020 0.000 0.002 0.444 0.001 0.000 0.000 0.242 0 13 8.727 0.000 0.000 0.000 0.743 0.000 0.000 0.000 0.050 0 14 2.163 0.009 0.000 0.003 1.121 0.000 0.000 0.000 0.051 0 15 0.000 0.004 0.000 0.000 0.109 0.000 0.000 0.000 0.007 0 18 9.021 0.018 0.002 0.000 0.286 0.000 0.000 0.000 0.028 0 19 0.000 0.038 0.000 0.019 0.509 0.000 0.000 0.000 0.155 0 spe.chwo came from: spe.norm - decostand(spe, normalize) spe.ch - vegdist(spe.norm, euc) spe.ch.UPGMA - hclust(spe.ch, method = average) spe.chwo - reorder.hclust(spe.ch.UPGMA, spe.ch) and the error is: Error in vegemite(spe, spe.chwo) : Cowardly refusing to use longer than 1 char symbols: Use scale The data in the dataframe is biomass data recorded to 4 digits. I'm wondering if this code is not working because my data is more than one digit long. Any suggestions or insight on how to get this code to work would be greatly appreciated. Thank you, Val -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Copyright Heat Map for species - code from Numerical Ecology with R
This list is not an appropriate forum for a discussion of the ethics of copyright in science. Please refrain from posting such material to the r-sig-ecology list. This particular instance has been addressed by the list owners, and should be considered closed. If you have concerns, please feel free to write to the list owners privately at r-sig-ecology-ow...@r-project.org Sarah, list owner On Wed, Jul 24, 2013 at 10:00 AM, Charles Novaes de Santana charles.sant...@gmail.com wrote: Dear François, Sorry if this message seems to be disrespectful. But it would be unfair if I let you do what you are doing to these two researchers without saying anything. Did you really need to send an email to Springer ethics.reporting? And did you really need to answer their question so lordly? You look like a kid that cries for Mom! As a Professor, you are supposed to teach and to encourage everyone to make the right thing. You are not supposed to punish anybody! We are members of a discussion list with the mission of sharing knowledge. The mission of helping people with their questions and to make science evolve with new and motivated scientists! More than that: It is a list about R, that is a free software, which major principle is Free Knowledge. Further, isn't share the knowledge one of the missions of a Professor, too? Your EGO can not be higher than all of these! Just to finish: It looks like you have never downloaded any paper, software or document from internet without the allowance of the right owners. Everybody knows it is not true! Look at your own message, as Jean smartly suggested! If we can not share knowledge in this list, I think it is time to go away! So, good bye, enjoy the knowledge you think is yours! Charles On Wed, Jul 24, 2013 at 3:16 PM, François Gillet francois.gil...@univ-fcomte.fr wrote: Valerie and Sarah, Thank you for encouraging piracy by posting the URL of an illegal PDF of our book :-( By the way, just look at ?vegemite and you'll find easily the solution to your problem: with the argument scale=log your numeric data will be converted to 1-char symbols. François ___ 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] extract beta.sim from dist type data (package betapart)
On Fri, Jul 19, 2013 at 5:12 AM, Elaine Kuo elaine.kuo...@gmail.com wrote: Hello Sarah, Thank you for the help very much. As already requested, please don't cross-post. Send your message to either the ecology list or the main help list, but NOT both. Please kindly advise manuals dealing with the object list (or dist). In addition, I would like to show the beta diversity index in a map. Please kindly advise any other R package in need. Every intro to R ever written talks about working with lists: they're a core class. You could try the one that came with your R installation and is on the main R website, or google for more options. Also note that in my original reply to the ecology list, I gave you a full working example. I can't answer your map question, because I don't have any idea what kind of spatial data you have to work with. GPS coordinates? Shapefiles? Raster? I can recommend the book Applied Spatial Data Analysis with R by Bivand, but I can't give concrete suggestions without a reproducible example. Sarah Elaine On Wed, Jul 17, 2013 at 10:20 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Replied to on the R-sig-ecology list, with a request not to cross-post. Briefly, the output is a list with named components, so can be extracted as usual. Sarah On Wed, Jul 17, 2013 at 5:50 AM, Elaine Kuo elaine.kuo...@gmail.com wrote: Dear List, This is Elaine. I am using beta.part to calculate the beta diversity index. The function of beta.part can generate three kinds of beta diversity indice at one time. However, it is Simpson index that I want. The calculation result is composed of three rows and N/A columns (dist class). I do not know how to extract one of the indice in the form of dist class. No relevant example is found the manual. (I tried as.vector as below but failed.) Please kindly help and thank you in advance. Elaine Code library(betapart) dist.sim-beta.pair(dataR, index.family=sor) # Unfold distance matrices into vectors data.sim-data.frame(as.vector(dist.sim)) -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] extract beta.sim from dist type data (package betapart)
Hi Elaine. Please do not cross-post to multiple help lists. Please do include a reproducible example. The help for beta.pair says that it returns a list, so you can extract the component you're interested in from that list in the usual way. If you don't know what the usual way is, then you should definitely read an Introduction to R or some other basic materials. Using data provided with the package: data(ceram.s) ceram.dist - beta.pair(ceram.s, index.family=sor) class(ceram.dist) names(ceram.dist) ceram.sim - ceram.dist[[beta.sim]] class(ceram.sim) Sarah On Wed, Jul 17, 2013 at 5:50 AM, Elaine Kuo elaine.kuo...@gmail.com wrote: Dear List, This is Elaine. I am using beta.part to calculate the beta diversity index. The function of beta.part can generate three kinds of beta diversity indice at one time. However, it is Simpson index that I want. The calculation result is composed of three rows and N/A columns (dist class). I do not know how to extract one of the indice in the form of dist class. No relevant example is found the manual. (I tried as.vector as below but failed.) Please kindly help and thank you in advance. Elaine Code library(betapart) dist.sim-beta.pair(dataR, index.family=sor) # Unfold distance matrices into vectors data.sim-data.frame(as.vector(dist.sim)) -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Beginner in R spatial Analysis
Well, Applied Spatial Data Analysis in R by Roger Bivand, fondly known as ASDAR, is a good place to start. There are also any number of tutorials and such online. Have you availed yourself of Google to find these and other resources? Sarah On Tue, Jul 9, 2013 at 11:16 AM, Ravichandra MONDRETI ravichandra.mondr...@cefe.cnrs.fr wrote: Hello everyone, I am new to R spatial analysis. Kindly suggest me an approach in which I can progressively develop my R spatial skills. Thanks in advance, Ravichandra Mondreti -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Extract from class object ltraj.
Hi Dylann, On Tue, Jun 11, 2013 at 11:36 AM, Dylann Kersusan kersusan.dyl...@gmail.com wrote: Hi everyone, I am working on class object ltraj mainly using the package Adehabitat HT and LT. Is there a way to extract from this class object the distances between relocations (dist)? I am pretty sure that it is possible and it has to be easy, but I am probably missing something. I tried the following though: ltrj.obj - as.ltraj(xy, date = dates, id = data$name, infolocs = data.frame(idnr = data$idnr)) str(ltrj.obj) List of 1 $ :'data.frame': 1328 obs. of 10 variables: ..$ x: int [1:1328] 1559670 1559665 1559687 1559695 1559695 1559686 1559687 1559674 1559648 1559666 ... ..$ y: int [1:1328] 7448557 7448603 7448611 7448592 7448594 7448598 7448599 7448568 7448522 7448532 ... ..$ date : POSIXct[1:1328], format: 2009-05-15 00:00:54 2009-05-15 00:30:21 2009-05-15 01:00:35 ... ..$ dx : int [1:1328] -5 22 8 0 -9 1 -13 -26 18 2 ... ..$ dy : int [1:1328] 46 8 -19 2 4 1 -31 -46 10 -2 ... ..$ dist : num [1:1328] 46.27 23.41 20.62 2 9.85 ... ..$ dt : num [1:1328] 1767 1814 1842 1766 1799 ... distance - ltrj.obj$data.frame$dist You're conflating class and name. A ltraj object is a list of data frames. Your list happens to only have one data frame, but there can be many. That data frame has 10 columns, and str() gives the names, as would names(ltrj.obj[[1]]) length(ltrj.obj) # should be 1, based on the output you showed ltrj.obj[[1]]$dist will give you what you're looking for, as would ltrj.obj[[1]][['dist']] -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Extract from class object ltraj.
Hi, On Tue, Jun 11, 2013 at 12:55 PM, Dylann Kersusan kersusan.dyl...@gmail.com wrote: Thanks a lot. It works perfectly fine! Though I don't know how to arrange that into a column, I shall find something not too time consuming. The code I provided extracts the distances as a vector. What are you trying to do with them? ltrj.obj[[1]]['dist'] will return a one-column data frame. You might like to take some time to read the intro to R documentation, particularly the parts about subsetting and the difference between [ and [[ to understand why. Sarah 2013/6/11 Sarah Goslee sarah.gos...@gmail.com Hi Dylann, On Tue, Jun 11, 2013 at 11:36 AM, Dylann Kersusan kersusan.dyl...@gmail.com wrote: Hi everyone, I am working on class object ltraj mainly using the package Adehabitat HT and LT. Is there a way to extract from this class object the distances between relocations (dist)? I am pretty sure that it is possible and it has to be easy, but I am probably missing something. I tried the following though: ltrj.obj - as.ltraj(xy, date = dates, id = data$name, infolocs = data.frame(idnr = data$idnr)) str(ltrj.obj) List of 1 $ :'data.frame': 1328 obs. of 10 variables: ..$ x: int [1:1328] 1559670 1559665 1559687 1559695 1559695 1559686 1559687 1559674 1559648 1559666 ... ..$ y: int [1:1328] 7448557 7448603 7448611 7448592 7448594 7448598 7448599 7448568 7448522 7448532 ... ..$ date : POSIXct[1:1328], format: 2009-05-15 00:00:54 2009-05-15 00:30:21 2009-05-15 01:00:35 ... ..$ dx : int [1:1328] -5 22 8 0 -9 1 -13 -26 18 2 ... ..$ dy : int [1:1328] 46 8 -19 2 4 1 -31 -46 10 -2 ... ..$ dist : num [1:1328] 46.27 23.41 20.62 2 9.85 ... ..$ dt : num [1:1328] 1767 1814 1842 1766 1799 ... distance - ltrj.obj$data.frame$dist You're conflating class and name. A ltraj object is a list of data frames. Your list happens to only have one data frame, but there can be many. That data frame has 10 columns, and str() gives the names, as would names(ltrj.obj[[1]]) length(ltrj.obj) # should be 1, based on the output you showed ltrj.obj[[1]]$dist will give you what you're looking for, as would ltrj.obj[[1]][['dist']] -- Sarah Goslee http://www.functionaldiversity.org ___ 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-help Digest, Vol 123, Issue 30
If you go to Rseek.org and search for circular statistics You'll find all sorts of options. I'm not familiar with Oriana so I don't know exactly what you need. Sarah On Sunday, May 26, 2013, Bruce Miller wrote: Hi all are there any R packages that include circular stats similar to Oriana (http://www.kovcomp.co.uk/**oriana/newver4.htmlhttp://www.kovcomp.co.uk/oriana/newver4.html )? I am interested in looking at annual patterns of bat activity where data will have date/times and relative abundance values for each Date. I would like to have a circular plot with the circumference axis the 12 months of the year and then a value of relative abundance and likely with ggplot2 this can be set to color= species. Tnx Bruce -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.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
Re: [R-sig-eco] biplot help
Hi Victor, On Sat, Apr 27, 2013 at 2:53 AM, victor asila asilavic...@yahoo.com wrote: Hi everyone, I am a young statistician learning and using R for analysis.I have been working on an ecological data and I have encountered some difficulty.The dataset has 60 rows and 11 columns.I want to plot the data using a biplot with different point symbols,that is each of the rows How are you plotting a biplot? There are several different possibilities, and the answer varies depending on what package you're using. In the simplest case, you can use pch (see ?par and many previous discussions on the main R-help email list). 1-10,11-20,21-30,31-40,41-50 and 51-60 should have different symbols and colours.I would appreciate if anyone would be able to help.I have attached the data in the word document for better understanding of my problem. This list doesn't allow Word documents as attachments. You'll get the best advice if you include your code right in the body of your email, along with a section of your data provided with something like: dput(head(yourdata, 20)) so we have a reproducible example to work with. In addition, it might be a good idea to read: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Any R packages equivalent to Fragstats?
Hi Bruce, Searching for FRAGSTATS at www.rseek.org will get you a couple of options. Sarah On Wed, Apr 17, 2013 at 1:22 PM, Bruce Miller batsnc...@gmail.com wrote: Hi all, Any/*R*/ packages that include the equivalent of FRAGSTATS for fragmentation indices? Tnx Bruce -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Mantel correlogram?
Kathy, It's really better to use dput() as suggested, and to keep the reply on the r-sig-eco mailing list so that others can both contribute to and benefit from the discussion. That also avoids the problem of expecting others to be able and willing to open attachments. So given a portion of your sample data provided with dput(), here's how to create and plot a Mantel correlogram. This is pretty much identical to the worked example in the help for mgram(). You'd probably benefit from reading the Intro to R that comes with your R installation and is available online. I don't think your troubles have much to do with mgram() itself. I don't know how you want to combine your data for all sampling dates; you could simply use rbind() but that's rather simplistic. library(ecodist) # a small subset of your data aprData - structure(list(x = c(0.835, 0.835, 2.505, 2.505, 3.68, 3.68, 5.845, 5.845, 7.515, 7.515, 9.185, 9.185, 0.835, 0.835, 3), y = c(8.75, 8.25, 8.75, 8.25, 9.75, 9.25, 9.75, 9.25, 9.75, 9.25, 8.75, 8.25, 7.75, 7.25, 6.75), Cmic = c(1734.497, 1677.772, 1679.34, 1464.895, 1787.466, 1672.751, 1952.623, 1874.111, 1728.851, 1910.611, 1733.986, 1758.636, 1790.217, 1653.951, 1754.646)), .Names = c(x, y, Cmic), class = data.frame, row.names = c(NA, -15L)) # first calculate the distance matrices using the # appropriate metric for your data aprSpace.ed - dist(aprData[, c(x, y)]) aprCmic.ed - dist(aprData[, Cmic]) aprCmic.mgram - mgram(aprCmic.ed, aprSpace.ed) # default mgram plot plot(aprCmic.mgram) Sarah On Tue, Mar 12, 2013 at 8:36 AM, Kathleen Regan kath.re...@gmail.com wrote: Dear Sarah, I will attach a sample Exel file from one date to this email. The plot is 10 x 10m, I have 60 samples/date, and 6 dates. No missing data. The problem is that for some of the microbial soil variables, my 50 cm lag distances weren't really close enough for fitting good semivariograms, although for others we have been able to generate reasonable ones. Would you prefer that I send you the .txt file? Kathy On Tue, Mar 12, 2013 at 12:44 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Hi Kathy, It's easiest to answer questions like that if you provide enough of your data to create a reproducible example, like: dput(head(mydata, 15)) But it sounds like you may just need subset(), rather than this being a question about Mantel correlograms per se. A Mantel correlogram is a good choice if your hypothesis is expressed in terms of distances, rather than in terms of raw data. It can't magically make up for insufficient data: if you don't have enough data to calculate a meaningful semivariogram, you also don't have enough to calculate a meaningful Mantel correlogram. Sarah On Tue, Mar 12, 2013 at 7:27 AM, Kathleen Regan kath.re...@gmail.com wrote: I would like to use the package ecodist to compute Mantel correlograms for particular variables for each of 6 different time points. Each sample at each time point has unique x and y coordinates on a plot. I have saved a test file as a matrix, and can read in R that x and y as well as my variables of interest are all present in the matrix file. I just don't know how to write the command for a Mantel correlogram for (e.g.) Cmic (one variable) for a particular sampling date, as well as Cmic for all 6 sampling dates (which, if they could be plotted all on one graph would be super.) The point of this is to see how Cmic (and other variables) changes in both space and time over my plot. I will then look at other belowground variables and aboveground plant biomass data for each date in the same way. I'm not even sure Mantel correlograms are the best choice here, but sadly, my lag distances for my samples aren't close enough together for me to get nice semivariograms. Originally I had hoped to have both conventional stats for changes over time coupled with maps to show changes in space at each time point. It was suggested to me that Mantel correlograms would be an alternative way to visualize spatial variability on my plot. I apologize in advance for my clumsiness with R. I have read the Legendre and Goslee papers, have studied (as best I can) both the books and the online info for this package, but since I have no (absolutely NO) experience with program languages, the help is often impenetrable to me. Any and all suggestions most welcome! Thanks very much -Kathy -- Kathleen Regan University of Hohenheim -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] quantifying directed dependence of environmental factors
That sounds like a job for path analysis or for structural equation modeling, depending on the level of sophistication desired and the hypotheses to be tested. There are plenty of good resources for both, in and out of R. Sarah On Wednesday, March 6, 2013, Jay Kerns wrote: Hello, I'm posting to this list because I believe it's the best place to go. My question is R related only inasmuch as all the work I've done so far has been with R and I expect any answers I get from here will lead me to more R work. I'm consulting with an ecologist and an engineer on a project related to a reservoir nearby. They've collected data on diatoms in the reservoir via core samples; they have sections of data over the past 100yrs. They are looking at the community structure plus other environmental factors over the same time period. We've done a ton of work already and there's no point trying to hash all of that out here. Short story: we did an NMDS, it fits OK (stress 0.17), there are obvious clusters in the ordination which correspond to a-priori clusters from ecological considerations (and which match an independent cluster analysis), we're really quite pleased overall. We checked for relationships with =envfit=, most environmental variables are *highly* significant, yet there are a couple which aren't significant at all. Here comes my question: The ecologist pointed out to me that our environmental variables don't have equal status (ecologically speaking); some variables lead to others. For instance, there are so-called ultimate factors (population, percentage farmland) which contribute to intermediate factors (suspended solids, total phosphorous) which in turn contribute to direct factors (AREA, pH,...) which then in turn contribute to diatom structure. We have measured data on all the above and several more. The model we are fitting with =envfit= is symmetric in those n environmental variables, but the ecology of the situation isn't symmetric, it's a directed top-down kind of relationship. He asked me, How can we quantify that? How can we demonstrate that? Can we quantify/demonstrate that? I don't know. There are ecologists on this list: what am I looking for, here? What methods do ecologists use to answer this (or related) question(s)? Feel free to direct me to papers, literature, textbooks, whatever. I'm trying to help answer this question and (this not being my subject specialty) I'm at a bit of a loss. If there are relevant R packages/vignettes/manuals you can point me to, that'd be cool too. Thanks for reading all the way down to here. Jay P.S. If it hadn't been for the archives of this list containing lengthy and poignant answers to *several* questions I've had already then I couldn't even have made it this far. Thank you! -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.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
Re: [R-sig-eco] quantifying directed dependence of environmental factors
Hi, I'm not sure how one would combine SEM / graphical models with compositional dissimilarity as a response. You might be able to fit a series of models in adonis() or capscale(), comparing just direct factors to direct + intermediate, etc.. I don't have any good ideas on how you might test more complex causal structures. There's a fair bit of literature on Mantel-based path analysis, and other similar dissimilarity-based approaches. SEM can be used with composition as well, although not (I think) with the intermediate step of calculating dissimilarities. Besides journal articles employing those techniques, I like both of these: J. B. Grace, Structural Equation Modeling and Natural Systems, Cambridge University Press, Cambridge, UK, 2006. B. Shipley, Cause and Correlation in Biology: A User’s Guide to Path Analysis, Structural Equations and Causal Inference, Cambridge University Press, Cambridge, UK, 2000. Sarah Given that you are dealing with diatoms across space (with environmental measurements) and down time (in cores, often without environmental measures), there may be an alternate approach possible based on calibration approaches to inferred environments (e.g., WACAL) or modern analogs. I would look at packages bio.infer, paltran, fossil, and analogue, and search to see if anyone has pushed them in the direction you want to go. Tom On Thu, Mar 7, 2013 at 6:50 AM, Jay Kerns gjkerns...@gmail.com wrote: Dear Sarah, On Thu, Mar 7, 2013 at 9:32 AM, Sarah Goslee sarah.gos...@gmail.com wrote: That sounds like a job for path analysis or for structural equation modeling, depending on the level of sophistication desired and the hypotheses to be tested. *Yes!* I said almost the exact same thing (I didn't say anything about Path Analysis because I don't know much about it), but I had it in my mind that SEM was targeted more to sociological things and didn't know if/that it was common in ecological contexts. Anyway, it's nice to hear that word coming from somebody else. There are plenty of good resources for both, in and out of R. Indeed. I have some work to do. Thank you. -- Jay -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] How do I convert a matrix from abundant into presence/absence data?
Assuming you have nothing unusual going on, here are some example data and one possible solution: mydata - data.frame(A=c(0, 10, 25), B=c(1, 5, 15), C=c(3, 0, 0)) mydata A B C 1 0 1 3 2 10 5 0 3 25 15 0 mydata[mydata 0] - 1 mydata A B C 1 0 1 1 2 1 1 0 3 1 1 0 On Tue, Feb 12, 2013 at 4:04 PM, Cory Redman corymred...@gmail.com wrote: I am sure there is any easy solution to this, but due to my monkey-level understanding of R, I need some help and can't seem to find the answer to my question via the web. I have been successful in importing an abundance dataset (taxa = rows, sample sites = columns) into R, but I want to rerun some analyses by converting this dataset into presence/absence data, How do I do this? Cheers, Cory -- Sarah Goslee http://www.functionaldiversity.org ___ 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 with function iucn_summary() of taxize package, returning error in strsplit()
Hi Augusto, I took a quick look at the code for iucn_summary, and it looks like a bug to me. I copied the package maintainer on this reply, as is appropriate for problems with a particular package. It looks like: pop - xpathSApply(h, //div[@id=\population\]/text()[preceding-sibling::br], xmlValue) is returning an empty list, which then throws an error in the next line: pop - do.call(rbind, lapply(strsplit(pop, split = :), rbind)) It looks like the function works well for complete cases, but has problems with certain missing/different data (easy mistake I've committed myself a time or two). You've hit on one of those fringe cases by accident, and it should be an easy update to the package. Sarah On Wed, Dec 19, 2012 at 2:15 PM, Augusto Ribas ribas@gmail.com wrote: Hello I'm using the package taxize and was trying to use the function iucn_summary() but it work perfectly with the examples, but when i try another name i receive the error msg: # iucn_summary(Molossus currentium) Erro em strsplit(pop, split = :) : argumento modo não caractere ## My r is in Portuguese, but it say argument mode not a character. I checked this specie on iucn site and its there, dunno what is the problem. the examples i cite are: # library(taxize) iucn_summary(Lynx lynx) iucn_summary() iucn_summary(Molossus currentium) # first two work properly, but the third give an error.. i have no idea of what i'm doing wrong. I'm using ubunto here, with R 2.15.2 from emacs. Thanks for the attention. -- Grato Augusto C. A. Ribas -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Package bio.infer: Error Matching Taxa to ITIS Table
Hi Rich, 2007 is forever ago in software years: get.taxonomic() no longer has an outputFile argument. If you can't figure out how to adapt the code in the JSS article by reading the help files, then your best bet is likely contacting the package maintainer to see if an updated version of the article code might be available. Alternatively, you could try the obsolete version of the package archived with the JSS article, but that's not really recommended. Sarah On Mon, Dec 10, 2012 at 6:39 PM, Rich Shepard rshep...@appl-ecosys.com wrote: Following the example in Lester Yuan's 2007 paper in the Journal of Statistical Software I've bumped into a fence and need help getting over it. My data is in the same data frame format as his bcnt.OR data set: head(bioinfer) SVN Taxon CountValue 1 WP220110711 Zaitzevia.parvula484 2 WP220110711 Tvetenia109 3 WP220110711Tubificidae 1054 4 WP220110711Sweltsa 11 5 WP220110711 Suwallia.pallidula 32 6 WP220110711 Stempellinella 11 and I implement the code on page 5 of this article: library('bio.infer') Loading required package: tcltk Loading Tcl/Tk interface ... done options(width = 60) data('itis.ttable') jercan - get.taxonomic(bioinfer, itis.ttable, outputFile = 'sum.taxo.tbl.txt') Error in get.taxonomic(bioinfer, itis.ttable, outputFile = sum.taxo.tbl.txt) : unused argument(s) (itis.ttable, outputFile = sum.taxo.tbl.txt) I'd appreciate someone explaining the error message to me so I can fix it and continue learning how to apply this package to my data. Rich ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Replacing values in a data frame
Hi, 2012/10/25 Manuel Spínola mspinol...@gmail.com: Dear list members, I want to replace the values of a numerical variable in a data frame called A. A X1X2 2 1.5 31 41.2 How to replace any value greater than 1 by the value 1 in the variable X2. I think you made a typo? I'm assuming you want to replace values in column X1 that are greater than 1 with the values in X2? All of your X1 are greater than 1 in your test example, but: with(A, ifelse(X1 1, X2, X1)) or A$X1[A$X1 1] - A$X2[A$X1 1] Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Workspace Question
Hi Michael, RData files created by save() or save.image() are compatible across versions. It sounds to me as if you overwrote your RData file, rather than anything to do with R versions. If the same filename is used, the RData file is overwritten, not appended to - only whatever is currently in your workspace. So if you used save workspace image with the default name, it would simply replace any previous workspace image in that directory. You can use save.image() with different names from the command line, and load as many separate RData files into your session as you'd like, although objects with the same names will be overwritten in your workspace. Also, pleae note that this is a more appropriate question for the main R-help list. Sarah On Wednesday, July 18, 2012, Michael Trianni wrote: I recently installed R version 2.14.1. After a session in 2.14.1, I saved the 'workspace image'. I then opened earlier R versions, 2.14.0 2.12.0, and the only objects listed were from the 2.14.1 session. All the work under those previous versions were gone, to my dismay. This did not happen when I was working in 2.14.0, as 2.12.0 objects were not affected when saving the workspace image in 2.14.0. Are the 2.14.0 2.12.0 objects retrievable or permanently deleted? [[alternative HTML version deleted]] -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.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
Re: [R-sig-eco] creating a pixel image
Hi, I'm not quite clear on what you want; see below. On Sun, Jul 8, 2012 at 6:37 PM, Kátia Emidio kat.emi...@gmail.com wrote: Hi, Someone could help me in create a pixel image using the SPATSTAT Package? spatstat doesn't deal with pixel images (raster?) but instead with point pattern objects. If that's what you want, ?ppp will get you started. Attached there is a sample from my data. The column names are (x and y coordinates, and elevation (alt_m). Thanks You don't provide either enough data or enough information for me to be able to know whether your data are gridded or not. If so, this will work for creating a SpatialGridDataFrame: library(sp) coordinates(mydata) - ~X+Y But I'm not sure if that's what you want: what are you trying to do, and what do your data represent? Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] creating a pixel image
Hi, It's good form to reply to the list rather than just to me, and I've taking the liberty of doing so. So is, How can I use im() from spatstat with data of this format to make a pixel image that I can use as a covariate for my analysis? a good summary of your question? Complete information up front means that people don't have to spend time asking for more information. Yes, im() can be used to make a pixel image from a matrix. You don't have a matrix, but instead a vector of points with x and y coordinates. It's normally easy to turn that into a matrix, but your points do not fall on a regular grid in the coordinate system being used, so I think you'd have to interpolate in some way to create such a matrix, which is an entirely different problem. Unless I'm missing something, you need to process your data before you can make a pixel image from it. The r-sig-geo mailing list might be of more use for that. You can see this by plotting with(mydata, plot(X, Y)) to see where the values are. For the rest of the list, Kátia sent me her full dataset offlist. I'm reluctant to include it here, but the point pattern it produces is on a regular grid, but rotated with respect to the coordinate system being used so that there are irregular distances between X and Y values. If it were my data, I'd use GIS software to interpolate it to a regular grid, though there are several ways of varying complexity to do that in R. Sarah On Mon, Jul 9, 2012 at 1:40 PM, Kátia Emidio kat.emi...@gmail.com wrote: Hi Sarah, I intend to use de alt_m (elevation) as a covariate on my species distribution. I am using Spatstat package, and there, if I have vectors with x/y coordinates and a covariate, it is possible I make a image from a matrix based on the elevation data. there is a function in spatstat, but I am not confident about use it from my data. I am sending the whole data, but the structure is the same. The function is: im(mat, xcol=seq_len(ncol(mat)), yrow=seq_len(nrow(mat)), xrange=NULL, yrange=NULL, unitname=NULL) Attached I'm sending the material that I have been used. See on page 63, may be you can undertand the functions. Also see on pags 82 and 83 about using covariates to study plant distribution. Thanks 2012/7/9 Sarah Goslee sarah.gos...@gmail.com Hi, I'm not quite clear on what you want; see below. On Sun, Jul 8, 2012 at 6:37 PM, Kátia Emidio kat.emi...@gmail.com wrote: Hi, Someone could help me in create a pixel image using the SPATSTAT Package? spatstat doesn't deal with pixel images (raster?) but instead with point pattern objects. If that's what you want, ?ppp will get you started. Attached there is a sample from my data. The column names are (x and y coordinates, and elevation (alt_m). Thanks You don't provide either enough data or enough information for me to be able to know whether your data are gridded or not. If so, this will work for creating a SpatialGridDataFrame: library(sp) coordinates(mydata) - ~X+Y But I'm not sure if that's what you want: what are you trying to do, and what do your data represent? Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] plot data on base of lonlat
I don't completely understand your question, but is it perhaps that west longitude is often represented as negative? Otherwise, please provide a reproducible example, using data from the cogizam package if you'd like, or at least a clear guide to where you've found this example and how it differs from your own data. Sarah On Thu, Jul 5, 2012 at 11:38 AM, Mahnaz Rabbaniha rab.mah...@gmail.com wrote: Hi groups i want plot of phytoplankton density on base of Lon lat, as same as the description on the cozigam package. but the main problem is the form of matrix Lon parameters in the example on eggdata that is negative ,how changed the longitude to this form ? thanks all Mahnaz -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] (no subject)
Hi Nils, Please use dput() to provide your data, and include the actual code and error messages. I assume you actually mean the ez package? It's important to provide a full explanation of the problem so that someone can offer good advice. Sarah On Wed, Jun 27, 2012 at 9:56 AM, Nils Gülzow nils.guel...@gmx.de wrote: Dear List, I have a problem with the ezANOVA package using for rm ANOVA or a problem with my statistic design of the experiment. (or both ;-)) My file looks like this (is also attached): sample days treatments repl. dispersal gbiov/rich/evenness 1-36 7,14,21 synchron,asynchron 1-4 low,medium dependent variable 28,35,42 controll high I would like to compare within SSw (treatment,dispersal) over time (days= between, SSb)for the listed variables gbiov, rich, evenness (dv), of course a single analysis for each variable. I used the repl. column as the SS identifier for the replicates, so I have for each combination of dispersal x treatment 4 replicates. My problem is that for one combination (asynchron x low) I have only three replicates and by checking with ezDesign, I add the missing replicates by reseting to zero for each time point, but still I get error message, except when I add days to the within-SSw and omit between-SSb. But that makes no sence to me. analysis-ezANOVA(data=..., dv=.(gbiov), wid=.(repl), within=.(treat,disp),between=.(days)) Perhaps, the SS identifier makes no sence?! Thanks in advance for solving the problem Best, Nils -- -- Sarah Goslee http://www.functionaldiversity.org ___ 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 message with function rda of package vegan
Hi, On Mon, Jun 11, 2012 at 12:35 PM, Duarte Viana viana.s...@gmail.com wrote: Hello all, Apologies for cross postings. I am running the function rda of the vegan library, like I did many times without having troubles, and I get the following error message: Error in if (rank) { : argument is not interpretable as logical. I am just testing a response matrix against a single explanatory matrix, which is the result of a model matrix with 4 dummy variables (coding for a factor of 5 levels). myrda-rda(resp, expl) When I, for instance, change the response matrix, it goes well. Does anyone know what might be happening? Not without a reproducible example, I'm afraid. Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Question about Mantel Test
Hi, Please don't cross-post. A Mantel test is most suited to problems that must be expressed in terms of distances, as Legendre states, although there is a mathematical relationship between correlation between distances and correlation between raw data. If your main concern is statistical testing, you can use a permutation test for significance of correlations without converting them to distances first, thus avoiding the parametric assumptions. If you want to use a Mantel approach to investigate *linear* spatial autocorrelation, then distance apart is relevant, and this does become a distance problem. You could then obtain the correlation between difference in variable X and difference in variable Y given their distance apart. Are you sure there's significant spatial autocorrelation? Have you tested for it in your data? If there is, is it meaningful in the context of your question? There are many approaches to dealing with spatial autocorrelation, and you might be best served to do some reading on your own and to consult a statistician, if you have access to one who is familiar with ecological data. Sarah On Thu, May 10, 2012 at 4:45 PM, Jaime Burbano Girón jaimeb...@gmail.com wrote: Hi every body. I have some questions about Mantel Test. I expect that with experience in spatial analysis of people in this list I can resolve them. Your explanations and suggestions will help me so much, so, thanks in advance. For contextualizing. I want to explore the association between some environmental variables: precipitation, temperature, bio-climatic indicators (construction of bio variables proposed in WorlClim), EVI (Enhanced Vegetation Index from MODIS-NDVI), NPP (Net Primary Product from MODIS), and VCF (Vegetation Continues Fields for trees from MODIS). *1. *At first instance, I thought to calculate Pearson´s correlation coefficient from Mantel Test approach, however, I have some doubts about what I am actually doing with this. I think that I can obtain a more accurate correlation coefficient with out the problem of spatial auto-correlation, due to permutation implicit in Mantel Test, using as matrices for calculate it two grids of the set of environmental variables. My real questions comes from the definition of matrices used in Mantel Test, because they are proposed from literature to represent a relationship between points included in them (often distances), but the grids do not represent this, they are the raw values of environmental variables. In fact, Legendre recommends that Mantel tests should not be used to test hypotheses about the relationships of the original data tables. So am I correct in try to perform a correlation coefficient with out the problem of spatial auto-correlation between any two grids using the Mantel Test? *2. *An other option that I have thought for involving distances is to perform the Mantel Test using a distance matrix between the two grids (this distance measure could be the correlation coefficient) and the geographic distance between grid points (Euclidean distance), since this is a way to explore if a variable is spatially autocorrelated, even this is less used than Moran Index or Correlogram. However, I am not sure if with this option I would test the spatial correlation of the distance measure used, or I would obtain a correlation index of the association of the two grids (distance measure used) with out the problem of spatial auto-correlation due to permutation. Or both? *3.* How else can you recommend me to measure the relationship between two environmental grids trying to minimize the effect of spatial auto-correlation? Regards to all and thanks in advance for your help. -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] unsubscribe me please
Hi Erin, You'll need to unsubscribe yourself, by following the link at the bottom of each and every message sent to this list. Sarah On Apr 4, 2012, at 7:20 PM, Erin Page erin.mycorrhi...@gmail.com wrote: -- Erin L. Page MS Environmental Science, Water and Wetland Resources SUNY College of Environmental Science and Forestry http://www.esf.edu/efb/horton/Page_bio.htm [[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-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] graph
Nobody? Can you provide a reproducible example of what you mean? I don't understand what you're trying to describe. Also, this might be better answered on the main R-help list. Sarah On Thu, Apr 5, 2012 at 8:56 AM, Mahnaz Rabbaniha rab.mah...@gmail.com wrote: Hi dear all who changed the format( size,font,,,) of graph text in r thanks -- Mahnaz -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] graph
Ah, how to change that. You'll need to read: ?par and specifically look at the cex options, lty, and col. Do note that methods derived from plot may not accept all of the par options, though. To get full control of customization, you may need to use plot() instead of plot.PCA(). Sarah On Thu, Apr 5, 2012 at 10:03 AM, Mahnaz Rabbaniha rab.mah...@gmail.com wrote: hi again foe example after plot a graph: plot.PCA(res.pca, axes=c(1, 2), choix=ind, habillage=37) #res.pca: the result of a PCA i want to changed some format of graph ( size the line,its color,,,) thanks On Thu, Apr 5, 2012 at 5:52 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Nobody? Can you provide a reproducible example of what you mean? I don't understand what you're trying to describe. Also, this might be better answered on the main R-help list. Sarah On Thu, Apr 5, 2012 at 8:56 AM, Mahnaz Rabbaniha rab.mah...@gmail.com wrote: Hi dear all who changed the format( size,font,,,) of graph text in r thanks -- Mahnaz -- Sarah Goslee http://www.functionaldiversity.org -- Mahnaz Rabbaniha Senior expert of marine ecology Iranian Fisheries Research Organization (IFRO) P.O.Box: 14155-6116 , P.Code: 1411816618* Tehran, IRAN Phone: +98 21 44580953 Fax: +98 21 44580583 Mobile: +98 912 5790377 -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] question concerning nmds.min
Are you using ecodist? If so, you need to look at iris.nmds to get the stress and the r2. min(iris.nmds$stress) iris.nmds$r2[which.min(iris.nmds$stress)] The advantage of nmds.min() is that it lets you choose a particular dimension solution rather than the lowest available. For your example, the same thing can be achieved with iris.nmds$conf[[which.min(iris.nmds$stress)]] Sarah 2012/2/2 Gian Maria Niccolò Benucci gian.benu...@gmail.com: Hi all, I am trying to run a nmds with function nmds() Once I run the following code I wonder how to look to the R2 and stress value of the chosen configuration. iris.nmds - nmds(iris.md, mindim=2, maxdim=2, nits=50) iris.nmin - nmds.min(iris.nmds) Which among the 50 configuration the functions chose? How to look to its stress and R2 values? If I type iris.nmin I only got the X1 and X2 coordinates... Thanks in advance, Gian -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] question concerning nmds.min
In the next update of ecodist, nmds.min() will return the stress and r2 for the selected configuration. Thanks for the suggestion. Sarah 2012/2/2 Gian Maria Niccolò Benucci gian.benu...@gmail.com: Thank you, you were of great help. Cheers, G. 2012/2/2 Sarah Goslee sarah.gos...@gmail.com Are you using ecodist? If so, you need to look at iris.nmds to get the stress and the r2. min(iris.nmds$stress) iris.nmds$r2[which.min(iris.nmds$stress)] The advantage of nmds.min() is that it lets you choose a particular dimension solution rather than the lowest available. For your example, the same thing can be achieved with iris.nmds$conf[[which.min(iris.nmds$stress)]] Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] help
Hi, On Fri, Dec 9, 2011 at 7:13 AM, Mahnaz Rabbaniha rab.mah...@gmail.com wrote: Hi in my project i collected its data in excel sheet that i attached,data were non normal then i transformed them and check the normality by shapiro.test that it showed again non-normality therefore i decided used the MDS analyses in r and download this site ( http://www.statmethods.net/advstats/mds.html) but i haven't done it, i think the main problem is the form of excel matrix for doing it and also i want to know about different between CLASSICAL MDS and isoMDS. We need to know more about what you're donig to be able to help with the excel matrix. What is the problem? How are you importing it into R? ?cmdscale library(MASS) ?isoMDS offers some information about the algorithms used in the two approaches, as well as many references for more information Briefly and simplistically, the difference has to do with whether the algorithm attempts to preserve actual dissimilarities or rank-order dissimilarities. please help me because this method is new in iran Thanks in advance -- *Mahnaz Rabbaniha* *Senior expert of marine ecology * *Iranian Fisheries Research Organization (IFRO) * *P.O.Box: 14155-6116 , P.Code: 1411816618* Tehran, IRAN Phone: +98 21 44580953 *Fax: +98 21 44580583* *Mobile: +98 912 5790377* *Website: http://www.ifro.ir* -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Various test of significance
There are lots of ways to do many of those things, and we have no way of knowing which are most appropriate for your data and baseline assumptions. The very best thing you can do is learn how to find options for performing basic tasks yourself. Within R the help facility can be useful, especially ?? and apropos(). For web searching, I use http://www.rseek.org a lot for information on packages, functions, R tips. If you have specific questions after you spend some time familiarizing yourself with the options, then we can help. Sarah On Fri, Dec 2, 2011 at 7:28 PM, Michel Rapinski mrapi...@uottawa.ca wrote: Hi, I've got a response matrix (Y) composed of multiple quantitative variables of the same nature which I am subjecting to multivariate analysis. I was wondering if there was a simple way of testing the following 3 things in R: 1) Significance of the coefficients of correlation (from the computed correlation matrix of Y). 2) Independence of the Y variables. 3) Multinormal distribution test. Thank you, Michel -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Sources for learning mapping/GIS with R?
There's a spatial taskview that's the perfect place to start: installing the taskview will give you very nearly all the related packages. http://cran.r-project.org/web/views/Spatial.html For learning how to use them, Bivand et al's Spatial Analysis book is good: http://books.google.com/books/about/Applied_spatial_data_analysis_with_R.html?id=4gg8yx_lcj0C Sarah On Tue, Oct 25, 2011 at 1:11 PM, Raphael Mazor rapha...@sccwrp.org wrote: Can anyone recommend some basic resources for learning how to create maps with R? Or recommend packages that are particularly helpful? Thanks! -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Re : Display or save very long matrix
Excerpted from below, because all else is irrelevant: write.table(C:\\Users\\Documents\\DISC D\\ Mat1.txt,sep= ) You need to tell R *what* to write to a file, not just the file name. Please read ?write.table and also try write.table(Mat1, C:\\Users\\Documents\\DISC D\\ Mat1.txt,sep= ) Sarah On Thu, Sep 22, 2011 at 6:23 AM, momadou sow moma...@yahoo.fr wrote: Hi, Thank Sarah and David for your help. for David Galbraith For the moment, I did not use any text editor, I want to save all my matrix in a file which can be (.txt) or another. Sorry Sarah I missed a code line, also I tried write.table but I have not a saved file in my folder. RasterToColonne transforms raster to Colum. Here, the complete code used: library(raster) adresse-C:\\Users\\Documents\\DISC D\\Images282 RasterToColonne - function(AdresseRaster){ # to transform raster to Colum a - raster(adresse) CentreRaster - rasterToPoints(a) PixelColonne - as.data.frame(CentreRaster) PixelColonne - cbind(PixelColonne,coordonnee = paste(PixelColonne[,1],PixelColonne[,2],sep= )) colnames(PixelColonne) - c(Longitude,Latitude,ValeurPixel,Coordonnees) return(PixelColonne) } Mat1 - RasterToColonne(adresse) write.table(C:\\Users\\Documents\\DISC D\\ Mat1.txt,sep= ) Thank you for your help De : Sarah Goslee sarah.gos...@gmail.com À : momadou sow moma...@yahoo.fr Cc : R-sig-ecology@r-project.org R-sig-ecology@r-project.org Envoyé le : Jeudi 22 Septembre 2011 0h16 Objet : Re: [R-sig-eco] Display or save very long matrix Hi, I'm not sure why you want to display a matrix of that size to the screen, but why not use write.table() to save it to a file? Mat1 - RasterToColonne(adresse) If that isn't enough, then we might need to know what the function RasterToColonne() does. Or is that the function that you only included half of in your email? Sarah On Wed, Sep 21, 2011 at 5:06 PM, momadou sow moma...@yahoo.fr wrote: Hi, I extract the coordinates and pixel values on my image. Thus I want to display all my matrix and save it in a (. txt) file. I used this code: library(raster) adresse-C:\\Users\\Documents\\DISC D\\\Images282 a - raster(adresse) CentreRaster - rasterToPoints(a) PixelColonne - as.data.frame(CentreRaster) PixelColonne - cbind(PixelColonne,coordonnee = paste(PixelColonne[,1],PixelColonne[,2],sep= )) colnames(PixelColonne) - c(Longitude,Latitude,ValeurPixel,Coordonnees) return(PixelColonne) } Mat1 - RasterToColonne(adresse) Mat1[1:5168101,] # number of rows = 5168101 In the result, I have not all the matrix. Only a part of the matrix appears. How can I save the entire matrix to a file (. txt)? Thank you in advance Momadou -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Display or save very long matrix
Hi, I'm not sure why you want to display a matrix of that size to the screen, but why not use write.table() to save it to a file? Mat1 - RasterToColonne(adresse) If that isn't enough, then we might need to know what the function RasterToColonne() does. Or is that the function that you only included half of in your email? Sarah On Wed, Sep 21, 2011 at 5:06 PM, momadou sow moma...@yahoo.fr wrote: Hi, I extract the coordinates and pixel values on my image. Thus I want to display all my matrix and save it in a (. txt) file. I used this code: library(raster) adresse-C:\\Users\\Documents\\DISC D\\\Images282 a - raster(adresse) CentreRaster - rasterToPoints(a) PixelColonne - as.data.frame(CentreRaster) PixelColonne - cbind(PixelColonne,coordonnee = paste(PixelColonne[,1],PixelColonne[,2],sep= )) colnames(PixelColonne) - c(Longitude,Latitude,ValeurPixel,Coordonnees) return(PixelColonne) } Mat1 - RasterToColonne(adresse) Mat1[1:5168101,] # number of rows = 5168101 In the result, I have not all the matrix. Only a part of the matrix appears. How can I save the entire matrix to a file (. txt)? Thank you in advance Momadou [[alternative HTML version deleted]] ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] [pkg] *permute* an R package for restricted permutations
That sounds very useful (and means I can cross it off my own list). Thank you for your hard work. Sarah On Thu, Sep 8, 2011 at 4:56 AM, Gavin Simpson gavin.simp...@ucl.ac.uk wrote: Dear List, Yesterday, I rolled up the first public release of the *permute* package and submitted it to CRAN. This represents the first beta release of *permute* and presages significant changes to the way permutation tests are performed, and to the sorts of permutation available, in *vegan*. *permute* allows the following permutation designs: * free permutation (randomisation) * permutation of spatial transect or time series data via cyclic wrapping * permutation of spatial grids via toroidal wrapping Each of these can be used at one or both of the block level and the within-block level. Blocks of samples are defined by the argument `strata` as has been used in *vegan* for many years. As such, *permute* allows for testing of split-plot designs. For spatial data (transect or grid), the cyclic or toroidal wrapping can be performed forwards or backwards in either spatial dimension, and the same permutation can be used for the samples in each block (for example, in the case of time series data where the samples in each block have been exposed to the same time process). An major aim in writing *permute* has been to provide functionality found in the widely-used, commercial application Canoco. The main functions in *permute* are the `shuffle()` and `shuffleSet()` functions which generate a single permutation or a set of many permutations for a stated design. Permutation designs are defined using function `permControl()`. Function `allPerms()` can be used to generate the entire set of permutations for a given design, which is useful if there are only a small number of permutations possible for the combination of permutation design and number of observations and/or complete enumeration (an exact test) is required. With the release of *permute*, the older functions in *vegan* that implemented a previous version of these restricted permutations have been made defunct. Old code that utilised these functions should be ported to use the new functions in *permute*; help is available upon request. These changes are in *vegan* from version 2.0-0, which has also been released to CRAN. The main reason for splitting the permutation code out from *vegan* was that by doing so we might make this code available to other package authors without having to depend on the entirety of *vegan*. A nascent Vignette is provided with the package which aims to document the new functions and will, by version 0.8, include a section on using *permute* within functions for package authors wishing to make use of the functionality in *permute*. If you have questions about or comments on the package, contact me or post a message in the Forums section of the R-forge website[1] for the *vegan* stable of packages. Gavin Simpson [1] https://r-forge.r-project.org/forum/?group_id=68 -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] subsetting data in R
By default, read.csv() turns character variables into factors, using all the unique values as the levels. subset() retains those levels by default, as they are a vital element of the data. If you are studying some attribute of men and women, say height, even if you are only looking at the heights for women it's important to remember that men still exist. If you don't want influencia to be a factor, you can change that in the import stringsAsFactors=FALSE. If you do want influencia to be a factor, but want the unused levels to be removed, you can use factor() to do that. testdata - data.frame(group=c(A, B, C, A, B, C), value=1:6) testdata group value 1 A 1 2 B 2 3 C 3 4 A 4 5 B 5 6 C 6 str(testdata) 'data.frame': 6 obs. of 2 variables: $ group: Factor w/ 3 levels A,B,C: 1 2 3 1 2 3 $ value: int 1 2 3 4 5 6 subset(testdata, group==A) group value 1 A 1 4 A 4 subset(testdata, group==A)$group [1] A A Levels: A B C ?subset factor(subset(testdata, group==A)$group) [1] A A Levels: A Sarah On Sun, Apr 24, 2011 at 9:04 AM, Manuel Spínola mspinol...@gmail.com wrote: Dear list members, I have a question regarding too subsetting a data set in R. I created an object for my data: pa = read.csv(espec_indic.csv, header = T, sep=,, check.names = F) levels(pa$influencia) [1] AID AII AP The object has 3 levels for influencia (AP, AID, AII) Now I subset only observations with influencia = AID pa2 = subset(pa, influencia==AID) but if I ask for the levels of influencia still show me the 3 levels, AP, AID, AII. levels(pa2$influencia) [1] AID AII AP Why is that? I was thinking that I was creating a new data frame with only AID as a level for influencia. How can I make a complete new object with only the observations for AID and that the only level for influencia is indeed AID? Best, Manuel -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] ecodist (MRM) error message
Alfredo, I'd be happy to try to help, but need rather more information. What version of R, ecodist? What OS? What do your data look like - str() is very helpful in this regard, or possibly summary(as.vector(Dx)) and summary(as.vector(Dy)). What are Dx and Dy? How were the dissimilarities calculated? Can you provide a reproducible example so that I can see the error for myself? With only what you have provided here, there's nothing I or anyone else can do to assist you. Sarah On Mon, Mar 14, 2011 at 6:08 PM, Alfredo Tello alfredote...@gmail.com wrote: Hi Everyone, MRM is returning what seems to be a matrix singularity error: Error in solve.default(XX) : system is computationally singular: reciprocal condition number = 1.88323e-86 when running MRM(Dy~exp(Dx)). I would appreciate it if anyone could help me around this. Thanks, A -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] no splits possible - in mvpart
Hi Mike, You need to carefully read the help for mvpart, rpart, and rpart.control - this is a complex procedure and there are a lot of possible options and ways to screw up. cp is the complexity parameter - a proposed split must be as good or better than cp to even be considered. If you aren't getting any splits, then none of the splits possible in your data are good enough at that level. More formally, from the help for rpart.control: cp complexity parameter. Any split that does not decrease the overall lack of fit by a factor of cp is not attempted. For instance, with anova splitting, this means that the overall Rsquare must increase by cp at each step. The main role of this parameter is to save computing time by pruning off splits that are obviously not worthwhile. Essentially,the user informs the program that any split which does not improve the fit by cp will likely be pruned off by cross-validation, and that hence the program need not pursue it. I believe that classification trees (not clustering) as implemented in R are covered in some detail in MASS; you should probably also find and read that. Sarah On Fri, Jan 28, 2011 at 8:31 PM, Mike Marsh sw...@blarg.net wrote: I am clustering vegetation richness (0 or 1) data that is segregated by growth form, i.e. Shrub, Annual Grass, Perennial Grass, etc., using mvpart for comparison with clustering by hclust. The environmental file has four variables, Slope, Elevation, heatload, and Ecological Site (a measure of soil and land form type). When four of the six data files are analyzed, a split is successful when raw data are analyzed, but a message, No splits possible -- try decreasing cp appears when data standardized by scaler are submitted. My question: What does the message mean? How would I decrease cp. I have re-read De'Ath, 2002 (Ecology 83:1105) regarding cross-validation, and I assume that xerror in the table produced by printcp is that quantity. In the present instance, there are only two leaves to the tree, and further reduction of cp would seem impossible A further puzzle is that when the smallest dataset (not included in this analysis), with only 6 columns, is analyzed, a result is obtained for standardized data. The Shrub data resented here as an example, have 27 columns, the Annual.Forb data, 35 columns. Here is my script, with output: set.seed(1) Shrub.mrt-mvpart(Shrub~.,Qenv) printcp(Shrub.mrt) mvpart(form = Shrub ~ ., data = Qenv) Variables actually used in tree construction: [1] Alt.E Root node error: 69.727/22 = 3.1694 n= 22 CP nsplit rel error xerror xstd 1 0.23477 0 1.0 1.1064 0.09480 2 0.12882 1 0.76523 1.0372 0.10470 Shrub.std- scaler(Shrub, col=mean1, row=mean1) Shrub.std.mrt-mvpart(Shrub.std~.,Qenv) No splits possible -- try decreasing cp printcp(Shrub.std.mrt) rpart(formula = form, data = data) Variables actually used in tree construction: character(0) Root node error: 0/0 = NaN n=0 (22 observations deleted due to missingness) CP nsplit rel error 1 NaN 0 NaN set.seed(1) Annual.Forb.mrt-mvpart(Annual.Forb~.,Qenv) printcp(Annual.Forb.mrt) mvpart(form = Annual.Forb ~ ., data = Qenv) Variables actually used in tree construction: [1] Slope Root node error: 105.27/22 = 4.7851 n= 22 CP nsplit rel error xerror xstd 1 0.135579 0 1.0 1.1085 0.081214 2 0.096179 1 0.86442 1.0827 0.079488 Annual.Forb.std- scaler(Annual.Forb, col=mean1, row=mean1) Annual.Forb.std.mrt-mvpart(Annual.Forb.std~.,Qenv) printcp(Annual.Forb.std.mrt) mvpart(form = Annual.Forb.std ~ ., data = Qenv) Variables actually used in tree construction: [1] Elev Root node error: 4282.1/22 = 194.64 n= 22 CP nsplit rel error xerror xstd 1 0.15587 0 1.0 1.1015 0.12860 2 0.10174 1 0.84413 1.0949 0.12898 printcp(Annual.Grass.std.mrt) mvpart(form = Annual.Grass.std ~ ., data = Qenv) Variables actually used in tree construction: [1] heatld Root node error: 219.76/22 = 9.989 n= 22 CP nsplit rel error xerror xstd 1 0.12602 0 1.0 1.1179 0.43984 2 0.11866 1 0.87398 1.4865 0.51020 While output for the standardized data for annual forb is the same as with raw data, this is often not the case in my larger dataset. data files are appended, and will be provided separately on request. Thanks very much for looking at this. Mike Marsh Washington Native Plant Society -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] lines() adds extra line
R is doing just as you asked. If you look at the middle of c(x, x) the x values jump from 10 to -10 and R draws the line segment connecting them, as it's been told. c(x,x)[195:205] [1] 9.4 9.5 9.6 9.7 9.8 9.9 10.0 -10.0 -9.9 -9.8 -9.7 You might rather have: x2.rev - c(x, rev(x)) x.rev.pred - predict(lm(dataBoth.poly ~ x2.rev + I(x2.rev^2)+I(x2.rev^3)+I(x2.rev^4)+I(x2.rev^5)+I(x2.rev^6))) plot(x2.rev, x.rev.pred, type=l) Sarah On Mon, Jan 24, 2011 at 1:04 PM, Jane Shevtsov jane@gmail.com wrote: I'm trying a bit of an experiment with polynomial curve fitting (don't worry, I wouldn't do this to actual data -- it's just a toy model for a specific question). When I generate a linear model of the data and plot it using plot(), everything works fine. But when I use plot(..., type=l) or lines(), I get an extra line connecting two points. How do I stop this from happening? Here's the code: x = seq(-10, 10, by=0.1) data1poly - 0.1*x + 0.2*x^2 + 0.3*x^3 + 0.4*x^4 + 0.5*x^5 + 0.6*x^6 + 0.7 + rnorm(length(x),1E-3, 1E-4) data2poly - 0.1*x + 0.2*x^2 + 0.3*x^3 + 0.4*x^4 + 0.5*x^5 + 0.6*x^6 - 1 + rnorm(length(x), 1E-3, 1E-4) dataBoth.poly - c(data1poly, data2poly) #Works well plot(c(x,x), predict(lm(dataBoth.poly ~ c(x,x) + I(c(x,x)^2)+I(c(x,x)^3)+I(c(x,x)^4)+I(c(x,x)^5)+I(c(x,x)^6 #Adds extra line plot(c(x,x), predict(lm(dataBoth.poly ~ c(x,x) + I(c(x,x)^2)+I(c(x,x)^3)+I(c(x,x)^4)+I(c(x,x)^5)+I(c(x,x)^6))), type=l) #or lines(c(x,x), predict(lm(dataBoth.poly ~ c(x,x) + I(c(x,x)^2)+I(c(x,x)^3)+I(c(x,x)^4)+I(c(x,x)^5)+I(c(x,x)^6 Thanks, Jane -- -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Vector overlays on nmds ordination
You can do that in both vegan and ecodist. Sarah On Tue, Nov 2, 2010 at 12:43 PM, Wade Wall wade.w...@gmail.com wrote: Hi all, I used to use PC-Ord for performing nmds ordinations but have started to use nmds in R as implemented in labdsv(). One of the things that I did like in PC-Ord was the vector (either species or environmental variable) overlay that could be implemented. Is there anything equivalent to this in R? Just wondering. I know that one could write the code, just didn't want to reinvent the wheel. Thanks for any information, Wade Wall -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Which statistical methods should I use?
Hi, We're happy to try to help, but we really need either a specific R question or a clearer statement of problem. For instance, I have no idea what a NAO index is, or what its statistical properties might be. You don't describe what kind of temperature and precipitation data you have, or give a clear idea of just what you are trying to test. R has good facilities for CCA. This article by Gonzalez et al. in the Journal of Statistical Software might be of use: http://www.jstatsoft.org/v23/i12/ along with the associated R package. If you have questions about applying those methods after you read the paper and the package help and work through the examples, then please explain more clearly what you need so that we can help you. Sarah On Fri, Mar 5, 2010 at 4:43 AM, Mustafa Tufan Turp turcoma...@gmail.com wrote: Dear members, I have a research on different NAO indices and its impacts on local temperature and precipitation trends. So which correlation method is the best to see their statistical relationship? I thought using Canonical Correlation Analysis works well. By the way I am new at R and can you recommend some packages? Does the CCA help me for analyzing and plots? I need your answers urgently. Thank you. Regards. Tufan Turp Bogazici University -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Testing order on predicted data
You really don't give enough information - what's better? Are you looking for linear relationships? Single variables or many? Without knowing anything else, I think you might try looking at Spearman (rank) correlations. Sarah On Tue, Nov 3, 2009 at 7:36 AM, Corrado ct...@york.ac.uk wrote: Dear all, I have a strange situation: 1) I have some data that are associated with sites 2) I have two models that predict the data on the sites 3) I would like to understand which of the models predicts the order of the data better. In other words, I am not interested in the models predicting the values exactly, but only in predicting values that are in the same order (smaller to bigger). What is the best test? PS: Does that make sense? Best, -- Corrado Topi -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Rotations for PCoA?
On Mon, Oct 19, 2009 at 10:12 AM, Jan Hanspach jan.hansp...@ufz.de wrote: Dear Sarah, that sounds good to me, thanks! Still, I have two more questions: The variable fitting with vf() does only work when I dummy-transform my categorical variables. Are the derived correlations then still comparable to the Gower distance - PCoA scores where my categorical variables where defined as such? I think it only makes sense with quantitative variables. There's no direction to categorical variables, so how could you fit one? Usually with categorical variables I plot the ordination with different symbols to denote the class of the categorical variables, and look at pattern that way. Is it reasonable to do more than the correlations with two axes with vf(), i.e. after calculating the correlation for the first and the second axis doing the same for the third and the forth? I guess this is a very naive question, but shouldn't this work for the p-Values since they are calculated with a permutation procedure? You're fitting the variables to that ordination diagram. It's entirely possible that the best fit for dimensions 3 and 4 of a four-dimensional fit are not the same as the best fit of axis 3 and 4 by themselves. So it depends on your question. Alternatively, I think the vegan package has a more sophisticated vector- fitting function. Sarah -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] using two distance metrices in formula
And actually, MRM isn't quite part of the Mantel family, although there are strong mathematical relationships: Goslee, S. 2009. Correlation analysis of dissimilarity matrices. Plant Ecology. Online at: http://www.springerlink.com/content/k4051127l6430nr1/ for subscribing institutions. It isn't a good solution, but rather an attempt to reconcile the different perspectives mathematically. Sarah There has been a very similar discussion in the Ecology recently between my good friends, Hanna Tuomisto co vs. Pierre Legendre co. However, the point here and above exactly was that you cannot use dissimilarities on the RHS (lack of independence), but you must use rectangular data in dbRDA. If you use distances on the RHS you won't have dbRDA but you get Mantel family methods (like MRM in ecodist). The problem, of course, is how to map distances onto Euclidean space (= rectangular data) *and* still study the effects of the distances instead of the effects of *location*. I don't know any really good solution here, but all proposed solutions have their problems. Pierre Legendre, Daniel Borcard and Hanna Tuomisto have all tried to convince me of their point of view, and while all their conflicting arguments make sense, they are not yet an optimal solution. Cheers, Jari Oksanen -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Re: [R-sig-eco] Spatial sampling simulations
Erika, This article: http://dx.doi.org/10.1007/s11258-005-3495-x Behavior of Vegetation Sampling Methods in the Presence of Spatial Autocorrelation Plant Ecology Volume 187, Number 2 / December, 2006 used the gstat package to generate spatial patterns, and then sampled them using different quadrat layouts. The basic workflow: Use gstat to generate fake vegetation patterns. Sample the data using your quadrat layout. Analyze as if it were real data. You need to decide in advance how big a pixel is, so how many pixels per quadrat your samples are: that will depend on the size of the plants you are working on. More detailed help would require knowing more about what you are trying to do. Sarah On Thu, Nov 20, 2008 at 2:34 PM, Erika Mudrak [EMAIL PROTECTED] wrote: Hi everyone, I am trying to investigate how well a certain (quirky) quadrat layout will uncover underlying spatial phenomenon of plant locatons. I am using the geoR package to generate variograms, but I am noticing some interesting trends that may be artifacts of the sampling design rather than the natural phenomenon. I would like to conduct simulations where I generate a known spatial pattern, superimpose the quadrat layout, sample from that, and analyze the resulting variogram. I see that geoR has a sample.geodata() function, but I don't want to pick random samples, I want to easily determine what my data would look like if I could only see it through the quadrat layout. Is there any function where I can easily do this? [I realize that there is a lot of literature about preferred quadrat layouts, but the data was taken before I arrived at school, handed to me, and if I can figure out how to work with it, then I get a prize - a degree!] Thanks Erika -- Sarah Goslee http://www.functionaldiversity.org ___ R-sig-ecology mailing list R-sig-ecology@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology