[R] main title on splited windows.
Dear all, How can I put a main title on the top of a windows? I would like put a title like This is my for graphics :-) v1-sort(runif(50)) v2-sin(v1*3.14) par(mfrow=c(2,2)) plot(v1,main=Sort V1) plot(v2,main=Sin(V1)) hist(v1,main=Histogram of V1) boxplot(v1,v2, main=Box plot - v1 v2) Thanks in advance Miltinho Brazil Flickr agora em português. Você cria, todo mundo vê. http://www.flickr.com.br/ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] rgdal memory error for a small map.
Dear all, I am trying to read a - almost for me - small map on R using rgdal package. This image have dimension of 1701x1401 and are stored on native ArcGis GRID format. When I see the files sizes, it is less then one megabyte. But unfortunately when I try read using readGDAL function it return a memory.size() error. I don´t know why it occours, if it is a small map. Below you can see GDALinfo(), readGDAL() = with the error, sessionInfo() and memory.size() outputs. Any idea? Kind regards, miltinho Brazil GDALinfo('al001_frag') Closing GDAL dataset handle 0x0134d310... destroyed ... done. rows1701 columns 1401 bands 1 ll.x0.5 ll.y1701.5 res.x 1 res.y 1 oblique.x 0 oblique.y 0 driver AIG projection NA fileal001_frag tst-readGDAL(al001_frag) al001_frag has GDAL driver AIG and has 1701 rows and 1401 columns Closing GDAL dataset handle 0x020d7c68... destroyed ... done. Warning messages: 1: Reached total allocation of 479Mb: see help(memory.size) 2: Reached total allocation of 479Mb: see help(memory.size) * sessionInfo() R version 2.5.0 (2007-04-23) i386-pc-mingw32 locale: LC_COLLATE=English_Jamaica.1252;LC_CTYPE=English_Jamaica.1252;LC_MONETARY=English_Jamaica.1252;LC_NUMERIC=C;LC_TIME=English_Jamaica.1252 attached base packages: [1] stats graphics grDevices utils datasets methods [7] base other attached packages: rgdal sp 0.5-13 0.9-14 memory.size() [1] 218914992 http://yahoo.com.br/oqueeuganhocomisso [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Crossing native ArcGis GRID with a XY coordinate table
Dear All, I have about 50 native ArcGis GRID maps and I need read them on R. After that I need to cross these maps with a set of XY coordinates which are stored on a table. When XY coordinates of my table match with the pixels of my maps, I would like to store the values of the pixels as a collumn on my table. Thanks in advance for all help Miltinho Brazil Flickr agora em português. Você cria, todo mundo vê. http://www.flickr.com.br/ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Parsimony Analysis of Encemism in R?
Hi R-gurus, Is there a package for Parsimony Analysis of Endemism (Cladist) in R? Kind regards, Miltinho Brazil http://yahoo.com.br/oqueeuganhocomisso [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] MDS/NMDS: When and Why use or not use?
Dear all, I would like to know when I use NMDS stead PCA or CA analyses? Up to I know, I use PCA (or PCoA) for condense the great part of vaciance on the firsts axis, and CA (or DCA) when I would like to identify the structure/composition of data inside a matrix. But I have seem that nowadays many ecologists are using NMDS to dimension reduction on data matrices, and interpret the axis (1, 2 etc) like they do on CA or DCA. My question is if I can use the axis of NMDS output on regression like I can do when with PCA, PCoA, CA and/or DCA axis. What is the stress effect on the usage of NMDS axis on regression? Another question is if are there a good PDF text about MDS and NMDS available on the web. I know that on vegan library (Thanks Oksanen!!) there are same fuctions which deal with MDS, metaMDS. Are there other packages that also works with MDS/NMDS/isoMDS on R? What are the similarity/difference on them? All comments are very welcome! Kind regards, Miltinho Brazil http://yahoo.com.br/oqueeuganhocomisso [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Generating vetor (shapefiles) from AscGrid raster in R
Hi there, I need to convert a raster (ascGrid) format to Shape files. Is there a way of to do that on R? Kind regards miltinho http://yahoo.com.br/oqueeuganhocomisso [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Creating directory under Windows R session
Hi all, How can I create (and check the existence of) a directory in a R session under Windows(xp)? Kind regards, Miltinho http://yahoo.com.br/oqueeuganhocomisso [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Enc: Creating directory under Windows R session
Hi all, How can I create (and check the existence of) a directory in a R session under Windows(xp)? Kind regards, Miltinho http://yahoo.com.br/oqueeuganhocomisso [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] AIC for lrm(Hmisc/Design) model.
Dear all, I am adjusting a Logistic Regression Model using lmr() function of Hmisc/Design package. Now I would like to compute AIC for this model. How can I do that? Kind regards, miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] skiping N value when using scan()
Hi there, I have a so big text file which contents are just values varing from 1 to 5. The size of this file are about 800MB and I can´t read it in my R session because of memory limits. I would like to know if I can skip the firsts 10.000 values of the text file, and read the next 5.000 values. The real dimension of my file are 2048*2048*100 values. Kind regards, Miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] deleting lines and row small than a value
Hi there I made a correlation matrix from my data frama and I would like to delete all lines/rows when r-value is smaller than 0.7 How can I do that? Kind regards, Miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plotting a point graph with data in X-axis
Dear all, I have two data frame, on with a complete list of my field survey with frequency data of a sample species. This data frame looks like: simulation-data.frame(cbind(my.year=c(rep(2000,8),rep(2001,12),rep(2002,12)),my.month=c(5:12,1:12,1:12))) simulation$year.month-paste(simulation$my.year,_,ifelse(simulation$my.month=10,simulation$my.month,paste(0,simulation$my.month,sep=)),sep=) simulation$freq-sample(1:40,32) attach(simulation) plot(year.month, freq) As you can see, I have a collumn with the year and month of my samples, and a freq variable with simulated data. I would like to plot this data but when I try to use the plot showed above, I get a error message. After bypass this problem, I would like add points in my graph with simulated data for only a random number of survey month, but I need that the full range of surveys be kept on the X-axis. Just to simulate a sample I am using: simulation.sample-simulation[sample(1:length(year.month),8, replace=F),] simulation.sample$freq-sample(1:40,8) Any ideas? Kind regards Miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] adjusting a sigmoidal shaped regression
Hi R-friends How can I adjust a sigmondal shaped regression in R? My data looks like x-c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) y-c(10,11,11,14,15,35,42,49,80,120,130,138,149,150,151,150) plot(y~x) modlin-glm(y~x) yest-predict(modlin) lines(yest~x) thanks a lot Miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] deleting collumns with colSums==0
Dear all, I have some matrices which colSums are equal to zero and I would like to delete all them. How can I do that? Kind regards, miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] adjusting a power model in R
Dear R-gurus, How can I fit a power model in R? I would like adjust Y = b0*X^b1 or something like. Kind regards, Miltinho Brazil. __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Abundance data ordination in R
Dear R-gurus I have a data.frame with abundance data for species and sites which looks like: mydf-data.frame( sp1=sample(0:10,5,replace=T), sp2=sample(0:20,5,replace=T), sp3=sample(0:4,5,replace=T), sp4=sample(0:2,5,replace=T)) rownames(mydf)-paste(sites,1:5,sep=) I would like make an ordination analysis of these data and my worries is about the zeros (absence of species) into the matrix. Up to I read (Gotelli - A primir of ecological statistics, 2004), when I have abundance data I can´t compute Euclidian Distances because the zeros have the meaning of absence of the species and not as zero counting. Gotelli suggests one make principal coordinates analysis. I would like to here from you what you think about and what is the best packages and functions to I compute my distance matrices and do my ordination analysis. Can I considere zero as NA on my data.frame? Is there a good PDF book available about Multivariate Analysis for abundance data available on the web? Kind regards Miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Res: Create a new var reflecting the order of subjects in existing var
Hi Nguyen I know that this solutions is not so elegant, but I think that will work for you: set.seed(123);dat - data.frame(ID= c(rep(1,2),rep(2,3), rep(3,3), rep(4,4), rep(5,5)), var1 =rnorm(17, 35,2), var2=runif(17,0,1)) dat ID.freq-table(dat$ID) ID.freq ID.seq-NULL for (i in names(ID.freq)) { ID.seq-c(ID.seq,seq(from=1, to=ID.freq[i], by=1)) } dat$ID.seq-ID.seq dat Kind regards, Miltinho Brazil - Mensagem original De: Nguyen Dinh Nguyen [EMAIL PROTECTED] Para: r-help@stat.math.ethz.ch Enviadas: Domingo, 1 de Abril de 2007 23:00:16 Assunto: [R] Create a new var reflecting the order of subjects in existing var Dear R helpers I have a data set sth like this: set.seed(123);dat - data.frame(ID= c(rep(1,2),rep(2,3), rep(3,3), rep(4,4), rep(5,5)), var1 =rnorm(17, 35,2), var2=runif(17,0,1)) dat ID var1 var2 1 1 33.87905 0.02461368 2 1 34.53965 0.47779597 3 2 38.11742 0.75845954 4 2 35.14102 0.21640794 5 2 35.25858 0.31818101 6 3 38.43013 0.23162579 7 3 35.92183 0.14280002 8 3 32.46988 0.41454634 9 4 33.62629 0.41372433 10 4 34.10868 0.36884545 11 4 37.44816 0.15244475 12 4 35.71963 0.13880606 13 5 35.80154 0.23303410 14 5 35.22137 0.46596245 15 5 33.88832 0.26597264 16 5 38.57383 0.85782772 17 5 35.99570 0.04583117 I would like to create a new var in dat which reflects the order of each subject (ID), like this ID var1 var2 IDorder 1 1 33.87905 0.02461368 1 2 1 34.53965 0.47779597 2 3 2 38.11742 0.75845954 1 4 2 35.14102 0.21640794 2 5 2 35.25858 0.31818101 3 6 3 38.43013 0.23162579 1 7 3 35.92183 0.14280002 2 8 3 32.46988 0.41454634 3 9 4 33.62629 0.41372433 1 10 4 34.10868 0.36884545 2 11 4 37.44816 0.15244475 3 12 4 35.71963 0.13880606 4 13 5 35.80154 0.23303410 1 14 5 35.22137 0.46596245 2 15 5 33.88832 0.26597264 3 16 5 38.57383 0.85782772 4 17 5 35.99570 0.04583117 5 Thank you very much for your help Regards Nguyen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] main title in multi-plot
Dear R-gurus, I need to print several plots into a graphic device and I would like to print out a main title. My code looks like x-1:100 y-x^2 z-y/x w-exp(z) par(mfrow=c(2,2)) plot(y~x) plot(z~x) plot(w~x) plot(z~w) Kind regards, miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] logistic regression
Dear All, I would like adjust and know the R2 of following presence/absence data: x-1:10 y-c(0,0,0,0,0,0,0,1,1,1) I tryed use clogit (survival package) but it don´t worked. Any idea? miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] reading raw matrix saved with writeBin
Dear Friends, I saved a matrix - which contans values 0 and 1 - using following command: writeBin (as.integer(mymatrix), myfile.raw, size=1). It is working fine and I can see the matrix using photoshop. But now I need read the matrices again (in fact I have a thousand of them) as matrix into R but when I try something like mat.dat-readBin (myfile.raw,size=1) I can´t access the matrix Kind regards, Miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] reading BMP into R
Hi R-gurus How can I read my bmp files into R? Kind regards, miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] finding max into matrix
Dear r-friends, Starting from a random position of a matrix, I would like find the position (index) of max values using 3x3 and 5x5 windows. Just supose that I have something like: set.seed(1) my.values-round(runif(441)*21,0) my.matrix-matrix(my.values,21) image(my.matrix,xaxs=r,yaxs=r,col=heat.colors(10)) start.pos-c(0.5,0.5) # this position are c(11,11) points(start.pos[1]~start.pos[2]) So I would like to see what are the values great than the value of my current position, and go for the position where the value are great. When the greatest value are present on more than one neighbour position, so I would like use a 5x5 window to decide how path could help me to maximize the value. From a random position, I will stop when no more values (using 3x3 and 5x5 windows) are great than the position that I reach up. I know that there are some GIS solutions that do this, but I really need use R to implement in a package that I am programing now. Kind regards, miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] recovering collums of DF using a text var.list
Hello people, I would like to know how can I use a list of variables (a char list) to have access to the collums from a dataframe to be used in some analysis like, just as example, a ploting task on a for() loop. Of course the code below is just to understand the way. In this example I have a dataframe with several collumns (more then fifty in my case) and I would like do use only some of them. I really need use a var.list! a-seq(1,100,1) b-c(rep(c(1,2,3,4,5),20)) c-rnorm(100,0,1) d-runif(100,0,1) e-c^2 f-c/d g-c-d df-data.frame(cbind(a,b,c,d,e,f,g)) var.list-c(c,f,g) for (myvar in var.list) { plot(density(df$myvar)) # here I need recover df$c , df$f and df$g } Kind regards Miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Principal Component Analysis explained variance
Hi there, How can I know the explaned variance of a PC axis generated by prcomp()? Kind regards, miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] deleting row when any col is.na
Hello everyone, How can I delete rows from a data.frame where almost one collumns is.na()? Kind regards, miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] writing a fomated matrix
Hi R-gurus, I have a 1000x1000 matrix and I would like to write it in a ASC file, where each row from my matrix are written in a separated line. I tryed write() function, but it don´t work fine to me. any idea? Kind regards, Miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] good brochure about matrix operations
Hi there, I would like if is there a good PDF available about matrix operations in R. Kind regards, miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] sort dataframe by field
Hi there, How can I sort (order?) a data.frame using a dataframe field (evidence) as classifyer? My data.frame looks like: record model evidence 1 areatotha 6638.32581 2 areatotha_ca000 8111.01860 3 areatotha_ca000_Pais 1721.41828 4 areatotha_ca020 827.33097 5 areatotha_ca020_Pais 2212.40899 6 areatotha_ca040 3569.17169 7 areatotha_ca040_Pais 2940.01636 8 areatotha_ca060 992.62852 9 areatotha_ca060_Pais 4237.95709 10 areatotha_ca080 62.74915 11 areatotha_ca080_Pais 1726.55082 12 areatotha_Pais 52.02524 13 areatotha_ca000 3391.92930 14 areatotha_ca000_Pais 39.52170 15 areatotha_ca020 268.55875 16 areatotha_ca020_Pais 20.43317 17 areatotha_ca040 1698.75892 18 areatotha_ca040_Pais 43.90613 19 areatotha_ca060 350.79857 20 areatotha_ca060_Pais 51.04471 Cheers, Miltinho, Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] batch job GLM calculations
Hi, Someone help-me on this task some weeks ago, and it is working find to me. I use something like: - findmodels - function(modeltype = lm, dataset, pattern) { ls - ls(.GlobalEnv, pattern=pattern) mods - ls[sapply(ls, function(x) inherits(get(x), modeltype))] if (!missing(dataset)) { data.name - function(x) as.character(x$call[[data]]) mods - mods[sapply(mods, function(x) data.name == dataset)] } models - lapply(mods, get) class(models) - c(ensemble, class(models)) models } mod_1-glm() mod_2-glm() models-NULL models- findmodels(pattern=mod_) - So you can use a for (i in 1:length(models)) to extract the statistics tha you want for each model and save it in a file (I´m saving it easily in Access using RODBC). I hope this help, Miltinho Brazil Indermaur Lukas [EMAIL PROTECTED] escreveu: Hello I want to batch job the calculation of many GLM-models, extract some values and store them in a file. Almost everything in the script below works (read file, extract values and write them to file) except I fail in indexing the GLM with the modelstructure it should run. Running GLM's conventionally is no problem. Conventionally a GLM is calculated as: -- glm(ZlogHRS ~ ZRi+ZE+ZPROX_MN+ZED+ZAlwd+ZT2+ZW+ZN+Sex+y, family = gaussian, data=t.data) (just a note: dependent variable is ZlogHRS, while the others are indepent variables) Desired way: sequentially run GLM - I want R to take the model structure to take from a vector called modelstructure and paste it into the GLM like: glm(modelstructure[i], family = gaussian, data=t.data). It would considerably ease my workload if there is a solution to the indexing problem within a GLM. I appreciate any hint. Best regards Lukas p.s. my R skills are rather poor START R-CODE--- # Read file t.url - C://HR_calculations/2005_2006/HR_SIZE/Kandidatenmodelle_Berechnung/inputfiles/ t.tuti - read.table(paste(t.url, All_animals.txt, sep=),header=T) collect.results - function(x) { #resets vectors which will be filled i - 0 AICA - NA; #put models names hierarchically in vector modelnames - c(1=global, 2=biotic1, 3=biotic2, 4=abiotic) #keep track of changes in model names and number for (i in 1:length(modelnames)) #model structure of the four models given for all models to run #global modelstructure - c( ZlogHRS ~ ZRi+ZE+ZPROX_MN+ZED+ZAlwd+ZT2+ZW+ZN+Sex+y, #biotic1 ZlogHRS ~ ZRi, #biotic2 ZlogHRS ~ ZPROX_MN, #abiotic ZlogHRS ~ ZE) ts.model - glm(modelstructure[i], family = gaussian, data=t.data) # Extracts some mode results n[i] - length(resid(ts.model)) AICA[i] - AIC(ts.model) } #Writes results to data file x = data.frame( modelnames, n, AICA) write.table(x, paste(t.url, file=Results.txt), sep=\t, quote=F) END R-CODE--- °°° Lukas Indermaur, PhD student eawag / Swiss Federal Institute of Aquatic Science and Technology ECO - Department of Aquatic Ecology Überlandstrasse 133 CH-8600 Dübendorf Switzerland Phone: +41 (0) 71 220 38 25 Fax : +41 (0) 44 823 53 15 Email: [EMAIL PROTECTED] www.lukasindermaur.ch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] min() return factor class values
Hi R-friends I don´t know why the min() function below return the min value as factor. When i force the aicc.min using a as.numeric() function, it return a factor index (1,2,..) and not min value as I want. By the way, I included a sessionInfo() at the end of this e-mail. In fact I had the same problem (values as factor) on other part of my script and I noticed that it occour when I use cbind(). It is real? Any idea? Kind regards, Miltinho especies.aicc.min-data.frame() for (sp in levels(especies.aicc$especie)) + { + sele-subset(especies.aicc,especie==sp) + especies.aicc.min-rbind(especies.aicc.min,cbind(sp,aicc.min=min(sele$aicc))) + } especies.aicc.min sp aicc.min 1 Attila.rufus 6.7387056413613 2 Automolus.leucophthalmus 125.791300522824 class(especies.aicc.min$aicc.min) [1] factor --- sessionInfo() R version 2.4.0 (2006-10-03) i386-pc-mingw32 locale: LC_COLLATE=English_Jamaica.1252;LC_CTYPE=English_Jamaica.1252;LC_MONETARY=English_Jamaica.1252;LC_NUMERIC=C;LC_TIME=English_Jamaica.1252 attached base packages: [1] methods stats graphics grDevices utils datasets base __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] min() return factor class values
Dear Peter, I tryed something like head(especies.aicc) especie aicc 1 Attila.rufus 17.15934 2 Attila.rufus 11.41371 3 Attila.rufus 11.41371 4 Attila.rufus 19.55998 5 Attila.rufus 17.23780 6 Attila.rufus 19.22545 especies.min-aggregate.data.frame(especies.aicc,list (Especie=especies.aicc$especie),max) But it works fine only for mean FUN and not for min and max. Also also, when I use mean I got the following warnings: especies.min-aggregate.data.frame(especies.aicc,list (Especie=especies.aicc$especie),mean) Warning messages: 1: argument is not numeric or logical: returning NA in: mean.default(X[[1]], ...) 2: argument is not numeric or logical: returning NA in: mean.default(X[[2]], ...) In fact I need only min() and max(). Miltinho - Peter Dalgaard [EMAIL PROTECTED] escreveu: Milton Cezar Ribeiro wrote: Hi R-friends I don´t know why the min() function below return the min value as factor. When i force the aicc.min using a as.numeric() function, it return a factor index (1,2,..) and not min value as I want. By the way, I included a sessionInfo() at the end of this e-mail. min() is not doing anything out of the ordinary, but cbind'ing it with the character vector sp coerces it to character and rbind'ing to a data frame turns character vectors into factors... The whole thing looks like it could be a straightforward application of aggregate(). In fact I had the same problem (values as factor) on other part of my script and I noticed that it occour when I use cbind(). It is real? Any idea? Kind regards, Miltinho especies.aicc.min-data.frame() for (sp in levels(especies.aicc$especie)) + { + sele-subset(especies.aicc,especie==sp) + especies.aicc.min-rbind(especies.aicc.min,cbind(sp,aicc.min=min(sele$aicc))) + } especies.aicc.min sp aicc.min 1 Attila.rufus 6.7387056413613 2 Automolus.leucophthalmus 125.791300522824 class(especies.aicc.min$aicc.min) [1] factor --- sessionInfo() R version 2.4.0 (2006-10-03) i386-pc-mingw32 locale: LC_COLLATE=English_Jamaica.1252;LC_CTYPE=English_Jamaica.1252;LC_MONETARY=English_Jamaica.1252;LC_NUMERIC=C;LC_TIME=English_Jamaica.1252 attached base packages: [1] methods stats graphics grDevices utils datasets base -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ACCESS/Office : connecting
Hi there, How can I connect to a ACCESS (.mdb) file? In fact, I would like to connect to a blank file, write a data.frame as table and after that INSERT records using some insert command. Kind regards, Miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] defining color sequence in image()
Dear All, How can I define a color sequence for each image value? I have several images with values varying from 1 to 5, and I would like to assing a fixed color for each value (green for 1, yellow for 2...). I used somethink like: image(img,col=c(green,yellow,...)) but unfortunately whem I have absent values, the color that I defined for each values change. Thanks a lot, Miltinho Brazil PS : Merry Christmas!!! __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] fischer.test help
Hi there, I´m trying to follow the reading of the book The Nature of Scientific Evidence (by Mark Taper and Subhash Lele) using R. I would like to preparar R scritps from the exercises of this book available to world wide community. To do so, I will need some help of our R-helpers; On this book, the author proposed we use Fisher´s p-value tests for a pig sex rate = 0.5 from observed male=7929 and female 8304 (total = 16233). The authors sad Under the assumed binomial distribution, the probability of observing 7929 male is .823; any observation with fewer than 7929 or more than 8303 males will have a probability less than or equal to .8233 and thus be considered an extreme event. They also sad Summing the probability of all extreme events, we find that probability of observing an event as extrem as or more extreme than the observed 7929 males is 0.003331. How can a reach up these same p-values? Kind regards, Miltinho Brazil __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Contents of R-packages
How about library(help=yags) miltinho Chuck Cleland [EMAIL PROTECTED] escreveu: Ralf Finne wrote: Hi experts, How do I see the contents of a package that looks interesting? Efter I have loded the package, is there an command that gives me the contents or even better a summary or introduction. library(yags) # Load the package search() # Where is the package? [1] .GlobalEnv package:yags [3] package:nlme package:car [5] package:stats package:graphics [7] package:grDevices package:utils [9] package:datasets package:methods [11] Autoloads package:base ls(2) # What is in the package? [1] ar1mat csmat [3] mvnsamp print.yagsResult [5] yags yags.adeqReport [7] yags.control yags.glmReport [9] yags.make.libu yags.wcorReport ?yags # Help for a particular function Also, follow the package links here for brief descriptions, reference manuals, and vignettes: http://cran.us.r-project.org/src/contrib/PACKAGES.html Ralf Finne SYH University of Applied Sciences, Finland __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] organizing stats from a list of models
Hi there, I have a list of models (about 600 glm models) and I included the prefix mod_ on their name. Now I would like retrieve the list from the R environment and save their AICs (and other info) on a table. I´m trying something like: - y-runif(20,min=0,max=1) x1-runif(20,min=0,max=1) x2-runif(20,min=0,max=1) mymod_1 -glm(y~x1) mymod_2-glm(y~x2) mymod_3-glm(y~x1+x2) model.list-ls(pat=mymod_) model.list [1] mymod_1 mymod_2 mymod_3 - Now I would like have something like model_name call AIC mymod_1 glm(y~x1) 13.11942 mymod_2 glm(y~x2) 13.11942 mymod_3 glm(y~x1+x2) 13.11942 How can I do that? All the best, Miltinho - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] test of spatial dependence?? - ask an ecologist?
I never used it, but I beleave that it is a job for mantel.rtest() available on ade4 package. In fact Farrar are right, you will neet the XY coordinates. Give a look at Legendre Legendre text book. HTH, Miltinho Brazil David Farrar [EMAIL PROTECTED] escreveu: In addition to the 25 numbers, I assume you have coordinates of each field. Otherwise, I don't understand what you are trying to do. I think ecologists like to use a test due to Mantel in this situation. The prefix auto means self, of course, the idea being that measurements of the same variable under different conditions are correlated. I guess this would be a case of autodependence. For correlation versus dependence, check your intro stats book. de nada, X'X Farrar Xu Yuan wrote: hello R-friends, I am a R beginner and try to ask a basic question: How to test the spatial dependence of a column of data? for example, I have 25 agricultural fields, and I measure the average slope (%) or pH for each field. All I have is 25 numbers. PS, could someone confirm that spatial dependence is equivalent to spatial correlation or spatial autocorrelation or not. Thank you very much. XY [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] publicar tutorial en CRAN (translation)
Let me try help with a poor traslation: Mario Wrote Hi everyone, I would like to know how can I publish a tutorial at CRAN. In fact I wrote a tutorial in espanish about SWEAVE and would like share it with our community. Who I need contact to do so? Mario Alfonso Morales Rivera [EMAIL PROTECTED] escreveu: Hola, a todos los usuarios de R. Me gustaría saber que pasos hay que seguir para que un manual o tutorial acerca de R escrito por un usuario quede disponible en CRAN. Escribí un tutorial de Sweave en español y quiero colocarlo a disposición de los usuarios de R pero no se cuales son los pasos a seguir, a quien hay que dirigirlo y que requisitos se requieren para eso. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - Música para ver e ouvir: You're Beautiful, do James Blunt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] require(simecol) error
Hi there, I´m trying to use simecol package but I got the error showed below. I´m runnig R version 2.4.0 (2006-10-03). Kind regards, miltinho Brazil --- require(simecol) Loading required package: simecol Error in loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) : in 'simecol' methods specified for export, but none defined: fixInit, fixParms, fixTimes, plot, print, solver, solver-, out, inputs, inputs-, main, main-, equations, equations-, sim, parms, parms-, init, init-, times, times- [1] FALSE - __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] from table to df
Hi there, I have a two-entrance dataframe, and I would like generate a new dataframe with its frequency. I tryed this site-rep(c(s1,s2,s3),20) species-rep(c(a,b,a,c,d),12) df-data.frame(cbind(site,species)) df2-table(df) But when I convert df2 to data.frame I miss the square format. I would like have my data.frame like this: site a b c d s1 8 4 4 4 s2 8 4 4 4 s3 8 4 4 4 Any help? Miltinho - Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] from table to dataframe
Hi there, I have a two-entrance dataframe, and I would like generate a new dataframe with its frequency. I tryed this site-rep(c(s1,s2,s3),20) species-rep(c(a,b,a,c,d),12) df-data.frame(cbind(site,species)) df2-table(df) But when I convert df2 to data.frame I miss the square format. I would like have my data.frame like this: site a b c d s1 8 4 4 4 s2 8 4 4 4 s3 8 4 4 4 Any help? Miltinho - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] writing lists fastly on file
Hi there, I have a big amount of lists of data, each one with dimension 1024x1024. When I save it in an ASCII file (using write function) it take about 15 minutes. As I need run about 500,000 times this same routine, and I would like to do this save task in a fast way. In fact I will use these output files in another program that read ASCII or RAW/Generic Binary (8bits) formats. Each value from my lists ranges from 1 to 200 (integer values). Help, please. Miltinho Brazil - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] writing lists fastly on file
In fact I have somethig like mat.dat-matrix(rep(c(1,2,4,2,1,0,1,2),128*1024)) write (mat.dat,c:\\tmp\\mydat.txt) * remembering that I will run it about 500,000 times. The program that I will use to analyze (landscape metrics) my output files read text files ou generic binary files, where I can have each value separated by space (text format) or each value into a byte of 8 bits (for beneric binary files). A sample of generic binary is the RAW (row and columns) used for Adobe Photoshop. In fact, my matrix of data can be understood as a classifyed image. Kind regards, Miltinho Duncan Murdoch [EMAIL PROTECTED] escreveu: On 11/30/2006 6:55 AM, Milton Cezar Ribeiro wrote: Hi there, I have a big amount of lists of data, each one with dimension 1024x1024. When I save it in an ASCII file (using write function) it take about 15 minutes. As I need run about 500,000 times this same routine, and I would like to do this save task in a fast way. In fact I will use these output files in another program that read ASCII or RAW/Generic Binary (8bits) formats. Each value from my lists ranges from 1 to 200 (integer values). I think this depends on the details. Can you show us what str() gives for one of these lists? Can you tell us how flexible the other program is about the format of what it needs to see? RAW/Generic Binary sounds like a format for an image from a digital camera; there might be packages available in R that are specifically designed to write that format but I don't know them. Duncan Murdoch - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Generating confusion matrix / Kappa stats
Hi there, I classified an image and checked out it on the field. Now I have a table with three fields like: Field_ID Field_Class Image_Class 1 1 1 2 3 5 3 4 1 4 1 1 5 2 1 ... And now I need gerating a confusion matrix to compute Kappa statistic. First of all, how can I generate the confusion matrix from my input table? What package is good for compute Kappa statistics? Regards, Miltinho Brazil - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Splitting matrix into several small matrices
Hi R-friends I need to read a big matrix (something like 1024000x1024) into 1000 small matrices. After that, I need write each small matrix (1024x1024) into a asc file, putting de index of matrix (1:1000) on the file name. I´m makint it by a hard and unelegant way: mat-scan(file...) # reading list mat_r001-matrix(mat[1:1048576],1024,1024) # here I used list positions mat_r002-matrix(mat[1048577:2097152],1024,1024) mat_r003-matrix(mat[2097153:3145728],1024,1024) write (mat_r0001, file = mymat_r0001.txt) write (mat_r0001, file = mymat_r0002.txt) ... write (mat_r0999, file = mymat_r0999.txt) write (mat_r1000, file = mymat_r1000.txt) rm(mat_r001) rm(mat_r002).. ... rm(mat_1000) Helllp, please. Miltinho :-) BRAZIL - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] clear screen
For windows, how about ctrl L? Gabor Grothendieck [EMAIL PROTECTED] escreveu: There are a few versions for Windows here: http://tolstoy.newcastle.edu.au/R/help/06/02/21634.html On 11/5/06, Mauricio Cardeal wrote: Hello ! Please, how can I clear the RConsole screen ? Is there any clear command ? Thanks, Mauricio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] identify extremes positions of values into matrix
Hi R-friends around world! I have a matrix that looks like bellow one. Each cell are filled with values 0, 1 or 2. In fact I have a lot of 512x512 matrices, with values varying from 0 to 999. I need to retrieve the left and right columns and the top and botton lines of the matrix where occours for example the value 2. Column and row labels are included at the example. 1234567890 1 00 2 011100 3 011100 4 00 5 002220 6 000222 7 002200 8 00 At this example, the right answer are: collumns 3 and 8 lines 5 and 7 Any idea of how can I solve this? Kind regards, Miltinho - Música para ver e ouvir: You're Beautiful, do James Blunt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] identify extremes positions of values into matrix
Francisco, Thank you so much. It´s more than I need. You help was of great value. Kind regards, Miltinho Francisco J. Zagmutt [EMAIL PROTECTED] escreveu: Oi Milton, Is this what you are after? x=read.table(miltondat.txt) x V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 1 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 1 1 1 0 0 3 0 0 0 0 0 1 1 1 0 0 4 0 0 0 0 0 0 0 0 0 0 5 0 0 2 2 2 0 0 0 0 0 6 0 0 0 2 2 2 0 0 0 0 7 0 0 2 2 2 2 2 2 0 0 8 0 0 0 0 0 0 0 0 0 0 idx=which(x==2,arr.ind=T) #Index of observations with values == 2 . Notice the use of arr.ind=t to get the rows and columns of the observations idx row col 5 5 3 7 7 3 5 5 4 6 6 4 7 7 4 5 5 5 6 6 5 7 7 5 6 6 6 7 7 6 7 7 7 7 7 8 range(idx[,row]) #gives you the min and max of the rows with x==2 [1] 5 7 range(idx[,col])#gives you the min and max of the columns with x==2 [1] 3 8 You can refine this and wrap it in a function to make reports in a more suitable form Regards Francisco Dr. Francisco J. Zagmutt College of Veterinary Medicine and Biomedical Sciences Colorado State University From: Milton Cezar Ribeiro To: r-help@stat.math.ethz.ch Subject: [R] identify extremes positions of values into matrix Date: Fri, 3 Nov 2006 11:25:32 -0300 (ART) Hi R-friends around world! I have a matrix that looks like bellow one. Each cell are filled with values 0, 1 or 2. In fact I have a lot of 512x512 matrices, with values varying from 0 to 999. I need to retrieve the left and right columns and the top and botton lines of the matrix where occours for example the value 2. Column and row labels are included at the example. 1234567890 1 00 2 011100 3 011100 4 00 5 002220 6 000222 7 002200 8 00 At this example, the right answer are: collumns 3 and 8 lines 5 and 7 Any idea of how can I solve this? Kind regards, Miltinho - Música para ver e ouvir: You're Beautiful, do James Blunt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. _ Try Search Survival Kits: Fix up your home and better handle your cash with Live Search! http://imagine-windowslive.com/search/kits/default.aspx?kit=improvelocale=en-USsource=hmtagline - Música para ver e ouvir: You're Beautiful, do James Blunt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Individual Based Model and/or Cellular automata
Hi R-gurus, Is there someone working with Individual-Based-Models (IBM) or Agent-Based-Models (ABM) with our withour Cellular Automata (CA) in R? I´m looking for develop some ecological applications, Kind regards, Miltinho Brazil - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is there any method to do spatial sampling?
May be this work for rectangular image. require(rimage) img-read.jpeg(file.jpg) image(rgb2grey(img)) nsamples-1000 coordinates-NULL for (i in 1:nsamples) { coordinates-rbind( coordinates, cbind(x=as.integer(nrow(img)*runif(1)), y=as.integer(ncol(img)*runif(1 } But I sugest you give a look at adehabitat and rimage packages. Best, Miltinho ronggui [EMAIL PROTECTED] escreveu: I have a map of a district (which is JPG format), and I want to do a sptial sampling based on the map. So is there any function to do spatial sampling of this type? Thanks! -- Ronggui Huang Department of Sociology Fudan University, Shanghai, China »ÆÈÙ¹ó ¸´µ©´óѧÉç»áѧϵ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] comparing 2 lists
Hi there, Could someone help to compare to list. I do something like: list1-c(1,3,6,8,9) list2-c(3,5,1,0) mathlist-NULL for (i in list1) { for (j in list2) { if (i==j) mathlist-c(mathlist,i) }} mathlist Is there a more elegant way to solve this question? Kind regards Miltinho BRAZIL - Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Book for Maximum Likelihood Methods in R
Hi R-guys, Is there a good book for maximum likelihood methods in R? I´m looking mainly to Ecological approaches to apply ML. Any help? Kind regards, miltinho BRAZIL - Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] matrix with additional upper, botton, left and right cells
Dear R Gurus, I have a matrix dim(1000x1000) and I need create a second matrix with dim(1002x1002) and insert my first matrix at position col=2,line=2. Please, see an example below: 0050055050 555000 5000505005 5005000500 000555 and I need 300500550503 35550003 350005050053 350050005003 30005553 Thanks a lot, miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Plot Confidence Interval for Regression
Dear R-friends I fitted a regression using GLM and plotted fitted values agaist X axis. Now I need plot upper and lower confidence intervals (95%) for this fit. Acoording to ?lm help and can use something like : [ predict.lm(mod, se.fit=T, interval = confidence, level=.95) ] to estimate confidence intervals. In fact this command run fine, but I can´t plot upper and lower C.I. lines. Any help, Kind regards Miltinho - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Excluding columns from dataframe and selecting row records
Dear R-friends, I have to simple questions. First I would like to exclude some columns from a dataframe and after I need select rows that satisfy some conditions. My data frame looks like Region Species Bodysize Weigth Age Africa Sp1 10.2 20 2 Africa Sp2 12.2 12 2 Africa Sp3 15.3 18 3 Africa Sp4 11.5 40 4 Brazil Sp1 10.2 40 3 Brazil Sp2 22.2 32 2 Brazil Sp3 12.3 28 3 Brazil Sp4 21.5 30 5 And I need for example only columns Bodysize Weigth and Age when Region==Brazil AND Species==Sp2 AND Age=3 In fact my dataset is greater than this, but it is just a example. Thanks for all helps, Kind regards, Miltinho - Música para ver e ouvir: You're Beautiful, do James Blunt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] bootstrap for group and subgroup
Dear R-friends, I have a table data structured by group, subgroups, records and attributes. For each group and subgroup I have differente number of records (more than 200). I need bootstrap 100 records for each group/subgroup combinations and repeat it a big number of times. Could someone of you help me on this hard (almost for me) task. Kind regards, miltinho - Música para ver e ouvir: You're Beautiful, do James Blunt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Bootstraping for groups and subgroups and joing with other table
Dear R-experts, I have a table with following collumns: State, SamplePlot, Species and BodySize. I sampled bird species at 34 SamplePlots and 5 States (regions) monthly during two years. On each bird record I measured bodysize and identified the species. So I have many records of each species (about 150 species) at each SamplePlot and each Region (State). Now I would like bootstrap these data, selecting 50 records for each State/SamplePlot combinations and count how many species (richness) were sampled at bootstrap. I need to do this 1.000 times. After that and need join the number of species [obtained at each bootstrap and for each State/SamplePlot combination] with a dataframe that have other attributes for SamplePlot (like Area, Perimeter etc). Bellow follow a sample of these two tables (dataframes). Could someone help me on this task. Kind regards, Miltinho = Table 1 - Bird records State SamplePlot Species BodysizeSaoPaulo Site1 Spp01 4.35SaoPaulo Site1 Spp04 0.80SaoPaulo Site1 Spp01 4.45 SaoPaulo Site1 Spp02 6.46SaoPaulo Site1 Spp02 3.98SaoPaulo Site1 Spp02 9.82SaoPaulo Site2 Spp02 9.71SaoPaulo Site2 Spp01 7.38 SaoPaulo Site2 Spp03 9.30SaoPaulo Site2 Spp01 4.32SaoPaulo Site2 Spp01 6.80SaoPaulo Site2 Spp02 5.80SaoPaulo Site2 Spp01 1.53 RioJaneiro Site1 Spp02 1.37RioJaneiro Site1 Spp02 4.43RioJaneiro Site1 Spp01 3.31RioJaneiro Site1 Spp03 6.25RioJaneiro Site1 Spp01 3.40RioJaneiro Site2 Spp01 9.12RioJaneiro Site2 Spp01 0.80 RioJaneiro Site2 Spp01 6.37RioJaneiro Site2 Spp02 1.66 RioJaneiro Site2 Spp01 3.49RioJaneiro Site3 Spp02 8.98RioJaneiro Site3 Spp02 5.96RioJaneiro Site3 Spp01 8.28RioJaneiro Site3 Spp03 1.51Bahia Site1 Spp01 6.76Bahia Site1 Spp01 9.99Bahia Site2 Spp01 0.72Bahia Site2 Spp02 6.63 Bahia Site2 Spp02 3.41Bahia Site2 Spp01 8.85Bahia Site2 Spp01 8.13Bahia Site3 Spp02 4.41Bahia Site3 Spp01 9.49Bahia Site3 Spp02 6.77Bahia Site3 Spp02 0.64Bahia Site4 Spp01 6.97Bahia Site4 Spp03 8.34Bahia Site4 Spp01 5.46Bahia Site4 Spp01 5.52 Bahia Site5 Spp01 5.37Bahia Site5 Spp02 8.66 == Table 2 - Attributes of SamplePlot State SamplePlot AreaBahia Site1 10Bahia Site2 25Bahia Site3 70Bahia Site4 15Bahia Site5 5RioJaneiro Site1 32RioJaneiro Site2 45RioJaneiro Site3 10SaoPaulo Site1 23SaoPaulo Site2 45 - Música para ver e ouvir: You're Beautiful, do James Blunt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] En: Bootstraping for groups (right data tables)
Dear R-friends, Unfortunately the tables that I past on last email gone with bad visual structure. So I send it again. Sorry to do this so confuse. Miltinho Table1 - Bird records State,SampleSite,Species,Bodysize SaoPaulo,Site1,Spp01,4.39 SaoPaulo,Site1,Spp04,4.05 SaoPaulo,Site1,Spp01,2.75 SaoPaulo,Site1,Spp02,8.18 SaoPaulo,Site1,Spp02,0.80 SaoPaulo,Site1,Spp02,9.37 SaoPaulo,Site2,Spp02,2.85 SaoPaulo,Site2,Spp01,1.13 SaoPaulo,Site2,Spp03,9.83 SaoPaulo,Site2,Spp01,8.24 SaoPaulo,Site2,Spp01,5.38 SaoPaulo,Site2,Spp02,7.87 SaoPaulo,Site2,Spp01,9.53 RioJaneiro,Site1,Spp02,2.29 RioJaneiro,Site1,Spp02,2.34 RioJaneiro,Site1,Spp01,6.01 RioJaneiro,Site1,Spp03,1.10 RioJaneiro,Site1,Spp01,9.57 RioJaneiro,Site2,Spp01,9.61 RioJaneiro,Site2,Spp01,6.00 RioJaneiro,Site2,Spp01,2.37 RioJaneiro,Site2,Spp02,6.33 RioJaneiro,Site2,Spp01,0.11 RioJaneiro,Site3,Spp02,7.53 RioJaneiro,Site3,Spp02,7.74 RioJaneiro,Site3,Spp01,3.16 RioJaneiro,Site3,Spp03,6.29 Bahia,Site1,Spp01,7.30 Bahia,Site1,Spp01,2.21 Bahia,Site2,Spp01,4.69 Bahia,Site2,Spp02,5.02 Bahia,Site2,Spp02,5.37 Bahia,Site2,Spp01,2.62 Bahia,Site2,Spp01,0.74 Bahia,Site3,Spp02,0.60 Bahia,Site3,Spp01,3.07 Bahia,Site3,Spp02,5.25 Bahia,Site3,Spp02,5.02 Bahia,Site4,Spp01,8.80 Bahia,Site4,Spp03,2.39 Bahia,Site4,Spp01,2.47 Bahia,Site4,Spp01,1.70 Bahia,Site5,Spp01,8.33 Bahia,Site5,Spp02,1.81 Table2 - SamplePlot Attributes State,SampleSite,Area Bahia,Site1,10 Bahia,Site2,25 Bahia,Site3,70 Bahia,Site4,15 Bahia,Site5,5 RioJaneiro,Site1,32 RioJaneiro,Site2,45 RioJaneiro,Site3,10 SaoPaulo,Site1,23 SaoPaulo,Site2,45 __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] substr or split help needed
Dear R-friends I have several data files with about 1,900 lines (records) each. I´m using read.table command to read the files. The files looks like LID , TYPE , PLAND D:\Bijou-MC\Simula_P005_H100_R001.txt , Forest , NA D:\Bijou-MC\Simula_P005_H100_R001.txt , Forest , 10.2 D:\Bijou-MC\Simula_P010_H100_R001.txt , Forest ,9.2 --- My first problem is that some command (like hist(data$PLAND)) say that the data isn´t a numeric one. May be because the first PLAND value are NA? When I done read.table command I used something link: data-read.table (file=xxx.dat, head=T, sep=\,, na.strings=NA). Another problem is that I need parse the LID column. When I do print (head(data$LID) I receive the following result (look that the slash was lost on the read): D:Bijou-MCSimula_P005_H100_R001.txt D:Bijou-MCSimula_P005_H100_R001.txt D:Bijou-MCSimula_P010_H100_R001.txt Its ok to me, but now I need create the P, H and R columns into the data table as a parse of LID column. When I try use the command p-substr(data$LID, 19,3) I got an error message saying that the variable is not char one. Finally, I´d like drop the LID column and insert the P, H and R into the table. Thanks for your help! Kind regards, miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] using several columns from a Table in a procedure
Dear R-friends I have a table with more than 50 columns (variables). Many of them are numeric and others are of type char. I would like repeat a group of command using only a set of the numeric variables, excluding others (for example V8, V12 etc) and not using the char ones. As a sample I want: x11() plot (X, v2) model_v2-glm (v2~X) lines (X, predict(model_v2)) x11() plot (X, v3) model_v3-glm (v3~X) lines (X, predict(model_v3)) x11() plot (X, v4) model_v4-glm (v4~X) lines (X, predict(model_v4)) - Look that I even use de X variable agains the other ones. How can I do that? Another question is how can I change the name of a column in a table? Thanks A Lot Miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] bootstrap data from groups
Hi R-friends. I have a mammal´s dataset looking like: Region Species Sex Bodysize 1 Sp1 M 10.2 1 Sp1 M 12.1 1 Sp1 M 9.1 ... I have three regions, four species and the body size of 10 individual. I´d like to do a bootstrap resample (100 resamples) of 4 of 10 individuals for each Region, Species and Sex and compute de means and S.D. for the combinations Regions-Species-Sex. How can I do that? Thanks a lot, Miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Table collumn to single var in lowcase
Dear All, I have read a table using DataTABLE - read.table(mytable.txt, header=T) And get the following data structure Var1 VAR2 VaR3 Var4 ... How can I list all collumn names (in lowcase) and create variables from table collumns. By hand I do var1 - DataTABLE$Var1 var2 - DataTABLE$VAR2 var3 - DataTABLE$VaR3 var4 - DataTABLE$Var4 Unfortunatelly these data come as an output from other program and the data file have about 80 collumns. Thanks in advance! miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Clumpy in image Landscape Ecology metrics
Dear R-friends, Is there someone workingo with Landscape Ecology Metrics in R? I´m writing a short routine to compute a Percolation index in a map and I need to identify Clumpy in the image. My input data looks like 000 0011000 0011100 000 0111000 111 000 0011000 000 And I need the following result (each clumpy with diferent ID and using 8-neighbours). 000 0011000 0011100 000 0222000 222 000 0033000 000 See that only the first patch was identified with 1, the other with 2 and 3. Suggestions, Kind regards, miltinho __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Piecewise (broken stick) models in R
Hi there, I´m a newbie in R and I´m looking for some advice how to teste Piecewise (Broken Stick) models. I´have another simple question: how can I compute descriptive statistics for data grouped for two or more variables? See below, please. Year Site Repetition rainfall 1980 1 1 ... 1980 1 2 ... 1980 1 3 ... 1980 2 1 ... 1980 2 2 ... 1980 2 3 ... 1990 1 1 ... 1990 1 2 ... 1990 1 3 ... 1990 2 1 ... 1990 2 2 ... 1990 2 3 ... I´d like to compute the mean rainfall for each YEAR * SITE combination. Kind regards, Miltinho - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] En: R: Piecewise (broken stick) models in R Stats for groups
Data: Tue, 30 May 2006 16:08:26 -0300 (ART) De: Milton Cezar [EMAIL PROTECTED] Assunto: R: Piecewise (broken stick) models in R Stats for groups Para: [EMAIL PROTECTED] Chris Barker and everyone Thanks for your fast replay. Regarding the descreptive Stats, I can compute it for the full dataset, but I can´t comput it for groups of that. I used mean ( Rainfall [year==1980] ) without problem. But how can I get the mean Rainfall for Year==1980 AND Site=1; Year=1980 AND Site=2 etc. Regarding my question for Pieacewise Regression model It can really be done with liner models functions. In fact, the results are a set of models that work bether in different range of an X variable (for X varying 0 to 0.15 use model_1; for 0.16 to 0.46 use model_2... for X0,47 use model_3 etc. Sorry for my broken english, Regards a lot, Miltinho From: Barker, Chris [SCIUS] To: 'Milton Cezar' Sent: Tuesday, May 30, 2006 3:47 PM Subject: RE: [R] Piecewise (broken stick) models in R You can get descriptive statistics with mean(), var() or summary(). AS to broken stick, I can only speculate that's a variation on a regression. You may need to be more specific in your questions to the list, as I suspect its something easily done in the linear models functions. Chris Barker Associate Director, Biostatistics Scios Inc. 6500 Paseo Padre Parkway Fremont, CA 94555 Tel 510 248 2439 Fax 510 248 2451 == From: [EMAIL PROTECTED] On Behalf Of Milton Cezar Sent: Tuesday, May 30, 2006 11:42 AM To: r-help@stat.math.ethz.ch Subject:[R] Piecewise (broken stick) models in R File: ATT17883177.txt Hi there, I´m a newbie in R and I´m looking for some advice how to teste Piecewise (Broken Stick) models. I´have another simple question: how can I compute descriptive statistics for data grouped for two or more variables? See below, please. Year Site Repetition rainfall 1980 1 1 ... 1980 1 2 ... 1980 1 3 ... 1980 2 1 ... 1980 2 2 ... 1980 2 3 ... 1990 1 1 ... 1990 1 2 ... 1990 1 3 ... 1990 2 1 ... 1990 2 2 ... 1990 2 3 ... I´d like to compute the mean rainfall for each YEAR * SITE combination. Kind regards, Miltinho - - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html