[R] xls.getshlib() error in xlsReadWrite package under W7
Dear all, I installed xlsReadWrite package under Windows 7, and got error when trying to run xls.getshlib(). Please, see the errors below: require(xlsReadWrite) Loading required package: xlsReadWrite xlsReadWrite version (cran shlib) Copyright (C) 2010 Hans-Peter Suter, Treetron, Switzerland. !! Your installation contains the cran placeholder shlib (dll/so). Please get the regular shlib (420 KB) by executing the following command: xls.getshlib() Info, forum, issue tracker and manual download at http://www.swissr.org. BACKGROUND: Our own xlsReadWrite code is free, but we also use proprietary code (Flexcel, tmssoftware.com) which can only be distributed legally in precompiled, i.e. binary form. As CRAN 'generally does not accept submissions of precompiled binaries due to security reasons' we only provide a placeholder and you can download the binary shlib separately. NO GUARANTEES: We have done thorough tests initially and there are integrity checks, but we do _not_ give any guarantees. You can check/clone the source code at http://github.com/swissr/xlsreadwrite , in case of any issues we are happy to hear about them (bug tracker/forum/email). xls.getshlib() Loading required package: tools --- xls.getshlib running... --- - zipped shlib has been downloaded from ' http://dl.dropbox.com/u/2602516/swissrpkg/bin/win32/shlib/xlsReadWrite_1.5.1_dll.zip' to 'C:\Users\Miltinho\AppData\Local\Temp\Rtmp2cUZxb/xlsReadWrite.zip' - md5 hash value has been read from ' http://dl.dropbox.com/u/2602516/swissrpkg/bin/win32/shlib/xlsReadWrite_1.5.1_dll.zip.md5.txt' - zipped shlib has correct md5 hash - zipped shlib has been extracted to'C:\Users\Miltinho\AppData\Local\Temp\Rtmp2cUZxb/xlsReadWrite.dll' - try to unload existing shlib 'C:\Users\Miltinho\Documents/R/win-library/2.11/xlsReadWrite/libs/xlsReadWrite.dll' - try to unload existing shlib 'C:/PROGRA~2/R/R-211~1.0/library/xlsReadWrite/libs/xlsReadWrite.dll' Error in file.rename(fp, fp.backup) : 'source' must be a single string In addition: Warning messages: 1: In if (!file.exists(fp)) stop(existing (cran) shlib could not be found at ', : the condition has length 1 and only the first element will be used 2: In if (file.exists(fp.backup)) file.remove(fp.backup) : the condition has length 1 and only the first element will be used sessionInfo() R version 2.11.0 (2010-04-22) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252 attached base packages: [1] tools stats graphics grDevices utils datasets methods base other attached packages: [1] xlsReadWrite_1.5.1 Cheers milton [[alternative HTML version deleted]] __ R-help@r-project.org 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] avoiding reinstall already installed library
Dear R-experts, I am installing new libraries using install.packages(ggplot2,dependencies=T). But I perceive that many dependencies are already installed. As I am using a low-band internet, how can avoid reinstall installed libraries? cheers milton [[alternative HTML version deleted]] __ R-help@r-project.org 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] Re: Change class factor to numeric
Try arcilla-as.numeric(as.character(clay)) best milton On Tue, May 18, 2010 at 12:36 PM, Arantzazu Blanco Bernardeau aramu...@hotmail.com wrote: sorry I had a mistake sending my question without a subject. I do resend again. Please excuse me. Hello I have a data array with soil variables (caperf), in which the variable clay is factor (as I see entering str(caperf)) . I need to do a regression model, so I need to have arcilla (=clay) as a numeric variable. For that I have entered as.numeric(as.character(arcilla)) and even entering 'as.numeric(levels(arcilla))[arcilla]'the variable is resting as factor, and the linear model is not valid (for my purposes). The decimal commas have been converted to decimal points, so I have no idea of what to do. Thanks a lot Arantzazu Blanco Bernardeau Dpto de Química Agrícola, Geología y Edafología Universidad de Murcia-Campus de Espinardo _ Diseñar aplicaciones tiene premio. ¡Si eres desarrollador no esperes más! http://www.imaginemobile.es _ Recibe en tu HOTMAIL los emails de TODAS tus CUENTAS. + info __ R-help@r-project.org 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@r-project.org 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] avoiding reinstall already installed *package*
Hi Martin, thanks for your reply, and very thanks for your kind tips about package and library So, I was trying to understand *why* we load packages using library(). I suggest that developers killl the problem on its root, deleting library function :-) Good to know already installed packages will not be reinstalled. cheers milton On Tue, May 18, 2010 at 12:49 PM, Martin Maechler maech...@stat.math.ethz.ch wrote: { I've modified the subject; I can't stand it hitting square into my face ... } mr == milton ruser milton.ru...@gmail.com on Tue, 18 May 2010 12:36:23 -0300 writes: mr Dear R-experts, mr I am installing new libraries using mr install.packages(ggplot2,dependencies=T). mr But I perceive that many dependencies are already installed. As I am using mr a low-band internet, how can avoid reinstall installed libraries? There's no problem with installed libraries, as ... they DO NOT EXIST. These are *PACKAGES* ! Why do you think are you talking about the function install.packages() --- To answer the question you did want to ask: Do not be afraid: Depedencies are only installed when needed, i.e., no package will be downloaded and installed if it already is there. Martin Maechler, ETH Zurich mr cheers mr milton mr [[alternative HTML version deleted]] (another thing you should learn to avoid, please) [[alternative HTML version deleted]] __ R-help@r-project.org 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] avoiding reinstall already installed *package*
*but* going back to my question, is not true that already installed packages will not be reinstaled. I ran: install.packages(c(ggplot2),dependencies=T) install.packages(c(mgcv,bbmle,akima,drc,sensitivity,tgp),dependencies=T) and several packages installed during the first install.packages were reinstalled on the second install.packages. cheers milton On Tue, May 18, 2010 at 5:38 PM, William Dunlap wdun...@tibco.com wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Martin Maechler Sent: Tuesday, May 18, 2010 1:25 PM To: milton ruser Cc: r-help@r-project.org Subject: Re: [R] avoiding reinstall already installed *package* On Tue, May 18, 2010 at 18:06, milton ruser milton.ru...@gmail.com wrote: Hi Martin, thanks for your reply, and very thanks for your kind tips about package and library So, I was trying to understand *why* we load packages using library(). I've started to use and suggest using require(.) instead {as my efforts to introduce use() or usePackage() *and* deprecating library() where met with strong opposition} I hate to get into arguments over function names, but I would have thought that require(pkg) would throw an error if the required pkg was not available. It seems like require() can be used when pkg is not really required but library(pkg) is easiest when pkg is required to continue: { require(noSuchPackage); functionFromNoSuchPackage() } Loading required package: noSuchPackage Error: could not find function functionFromNoSuchPackage In addition: Warning message: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called 'noSuchPackage' { library(noSuchPackage); functionFromNoSuchPackage() } Error in library(noSuchPackage) : there is no package called 'noSuchPackage' Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com I suggest that developers killl the problem on its root, deleting library function :-) Good to know already installed packages will not be reinstalled. cheers milton On Tue, May 18, 2010 at 12:49 PM, Martin Maechler maech...@stat.math.ethz.ch wrote: { I've modified the subject; I can't stand it hitting square into my face ... } mr == milton ruser milton.ru...@gmail.com on Tue, 18 May 2010 12:36:23 -0300 writes: mr Dear R-experts, mr I am installing new libraries using mr install.packages(ggplot2,dependencies=T). mr But I perceive that many dependencies are already installed. As I am using mr a low-band internet, how can avoid reinstall installed libraries? There's no problem with installed libraries, as ... they DO NOT EXIST. These are *PACKAGES* ! Why do you think are you talking about the function install.packages() --- To answer the question you did want to ask: Do not be afraid: Depedencies are only installed when needed, i.e., no package will be downloaded and installed if it already is there. Martin Maechler, ETH Zurich mr cheers mr milton mr [[alternative HTML version deleted]] (another thing you should learn to avoid, please) [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] rcolorbrewer
?rev On Mon, May 3, 2010 at 4:06 PM, Steve Hempell sthemp...@gmail.com wrote: Can you reverse the color scheme order in rcolorbrewer. If so, how? [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] sensitivity analysis, input factors
Hi Szalai I had used only src function, and on that case you need to have a vector with your Y variable, and a data-frame with all your X (i.e. explanatory) variables. I have interest on stay in touch with others that have been using sensitivity package! bests milton On Tue, Apr 13, 2010 at 11:08 AM, Szalai Márk szalai.m...@mkk.szie.huwrote: Hi, I'm trying to conduct sensitivity analysis in R using the 'sensitivity' package. Although the description of functions seem straightforward, I cant succeed. The definition of input factors can be the problem. library(sensitivity) #A simple model with 4 input factor to test the morris function: model01=function(a1,a2,a3,a4) { Z-numeric(10) Z[1]-runif(1) Z[2]-runif(1,a1,30) Z[3]-6*runif(1,min(a1,a2),max(a1,a3)) Z[4]-runif(1,2,5)*runif(1,min(a2,a4),max(a2,a4)) Z[5]-0.5*runif(1,min(a3,a4),max(a3,a4)) Z[6]-2*runif(1,min(a1,a4),max(a1,a4)) Z[7]-runif(1) Z[8]-2*runif(1,min(2*a1,5*a4),max(10*a1,100*a4)) Z[9]-2.5*runif(1,min(a2,a3),max(a2,a3)) Z[10]-rnorm(1,10*a1,1) mean(Z) } xx=morris(model = model01, factors=c(a1,a2,a3,a4), r=4, design=list(type=oat, levels = 5, grid.jump = 3), binf =1,bsup=20, scale=F) Error message suggests that the second input factor is not used How should I define the input factors? Thanks in advance, Mark __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] reading excel into R
Dear Cheba Please, install the package xlsReadWrite I suppose that read.csv is to read csv files, not xls ones. cheers milton On Thu, Apr 1, 2010 at 6:19 AM, cheba meier cheba.me...@googlemail.comwrote: Dear all, I am new R user and I am sure that this question has been asked quite often and I have also googled it and read about it! I understood that in order to read excel sheet into R you need to open it and saved it as csv or text, is this true? or you can use read.delim2 and read.csv2 to do this without the following error dat - read.csv2(file=C:\\Dokumente und Einstellungen\\Cheba\\Desktop\\Rtemp\\ Results2010.xls,header = TRUE) Warnmeldung: In read.table(file = file, header = header, sep = sep, quote = quote, : unvollständige letzte Zeile von readTableHeader gefunden in 'C:\\Dokumente und Einstellungen\\Cheba\\Desktop\\Rtemp\\ Results2010.xls' dat [1] ÐÏ.à.. 0 Zeilen (oder row.names mit Länge 0) Thes same error I get when I use read.delim and demlim2! Is library(gdata) the solution? Sorry for any inconvenience caused. Regards, Cheba [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] barplot with error bar in lattice
Dear all, I have a data.frame like below and I need to plot horizonal with error bar only for upper limit. On the code below I am able to plot the bars within groups, but I need (1) change from vertical to horizonal plot and (2) add the error bar. any hint are welcome. milton mydf-read.table(stdin(),head=T,sep=,) mygroup,xlabel,yvalue,error Gr1,Bar1,1,0.5 Gr1,Bar2,2,0.7 Gr1,Bar3,2,1.0 Gr1,Bar4,2.5,0.5 Gr2,Bar1,1,2 Gr2,Bar2,1,1 Gr2,Bar3,3,1 Gr2,Bar4,4,0.5 require(lattice) barchart(yvalue~xlabel|mygroup, data=mydf) [[alternative HTML version deleted]] __ R-help@r-project.org 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] qplot(ggplo2): axis label sizes/colors
Dear all, How can I change the size and the color of axis? I would like that the xlab to be larger, xvalues to be larger, and xvalues in black instead of grey. x=runif(10) y=runif(10) require(ggplo2) qplot(x,y) cheers milton [[alternative HTML version deleted]] __ R-help@r-project.org 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] labels gone
Hi Zhongyi, I must confess I not understood completely what you need, but... Tau-seq(0.05,0.95,0.05); Pi - seq(0.19,0.01,-0.01); par(cex.axis=0.8,ps=9,mar=c(1.5,1,0.5,1), oma=c(1,1,0.2,1) ,tck=-0.01); plot(Tau,Pi, type='l', xlab=Tau,ylab=Pi,col=4, xaxt=n, yaxt=n); axis(1,labels=F) axis(1,line=-1, lwd=0) axis(2,labels=F) axis(2,line=-0.5, lwd=0) mtext(x_txt,side=1, line=0.5) mtext(y_txt,side=2, line=1.2) cheers milton On Tue, Mar 16, 2010 at 12:28 AM, Zhongyi Yuan zhongyi-y...@uiowa.eduwrote: Dear R users: I am drawing a graph with the following code: Tau-seq(0.05,0.95,0.05); Pi - seq(0.19,0.01,-0.01); par(cex.axis=0.8,ps=9,mar=c(1.5,1,0.5,1), oma=c(1,1,0.2,1) ,tck=-0.01); plot(Tau,Pi, type='l', xlab=Tau,ylab=Pi,col=4); I want to make the graph take as little space as possible. Here I run into two problems. One is that the labels are gone, the other is the scale numbers of axises are a little too far from my axises. Can anyone help me with this? I am new to graphics and have spent a lot of time on par but still not yet got it. Thanks. best, Zhongyi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] barplot with a probability density curve
Hi Olga, may be you can work around with the suggestions below, while other provide the best solution for your: barplot(c(1,2,3,5,2,3,1),names.arg=c(100,200,300,400,500,600,700), xlab=diameter,ylab=flow,main=some title,space=0.1) lines(lowess(c(1,2,3,5,2,3,1),f=1), type=b, lwd=2, lty=3, col=blue) cheers milton On Sun, Mar 14, 2010 at 5:32 PM, Olga Lyashevska o...@herenstraat.nlwrote: Dear all, I am making a barplot as following: barplot(c(1,2,3,5,2,3,1),names.arg=c(100,200,300,400,500,600,700),xlab=diameter,ylab=flow,main=some title,space=0.1) I am also trying to add a probability density curve, however using lines(density(c(1,2,3,5,2,3,1))) does not give a desired result. Any tips? Thanks Olga __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] modify the levels of a variable
Try data2$X-factor(data2$X) By the way, avoid call data as data, matrix as matrix, vector as vector. cheers milton On Wed, Mar 10, 2010 at 4:35 PM, clee cheel...@gmail.com wrote: If anyone can help with this, I would greatly appreciate it. When I subset a dataframe, and then create a table of on of the column variables, the levels of that variable are retained from the parent dataframe. Anyone know how to for example, say I have data like so: data: X Y a 2 b 2 a 3 b 3 a 5 if I do data2=subset(data,X==a) I get the new data frame: data2: X Y a 2 a 3 a 5 but if I do this... table(data2$X) I would get this: X Y 3 0 additionally when I write... levels(data2$X) I get... Factors w/ 2 levels: a, b I want it to be... Factors w/ 1 level: a Normally I would just move on and won't even bother but I'm working with a variable that has 204 levels and only 84 of those are meaningful to me. How can I reset the levels of a column variable? help please! Thanks! -- View this message in context: http://n4.nabble.com/modify-the-levels-of-a-variable-tp1588089p1588089.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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] how to convert character variables into numeric variables directly
Try: as.numeric(as.character( typec)) milton On Mon, Mar 8, 2010 at 12:55 PM, Xumin Zeng xumin.z...@abbott.com wrote: Here is the example. age=18:29 height=c(76.1,77,78.1,78.2,78.8,79.7,79.9,81.1,81.2,81.8,82.8,83.5) type=c(A, B, C, D,A, B, C, D,A, B, C, D) typec=c(0,4,2,9,0,7,2,3,0,1,2,3) typen=c(0,1,2,3,0,1,2,3,0,1,2,3) data1=data.frame(age=age,height=height, type=type, typec=typec, typen=typen) data1[,3]=as.numeric(data1[,3]) data1[,4]=as.numeric(data1[,4]) data1[,5]=as.numeric(data1[,5]) print(data1) and I got the output as: age height type typec typen 1 18 76.11 1 0 2 19 77.02 5 1 3 20 78.13 3 2 4 21 78.24 7 3 5 22 78.81 1 0 6 23 79.72 6 1 7 24 79.93 3 2 8 25 81.14 4 3 9 26 81.21 1 0 10 27 81.82 2 1 11 28 82.83 3 2 12 29 83.54 4 3 The typec is not what I expected. How can I get the direct conversion from character to numeric and get the following output? age height type typec typen 1 18 76.11 0 0 2 19 77.02 4 1 3 20 78.13 2 2 4 21 78.24 9 3 5 22 78.81 0 0 6 23 79.72 7 1 7 24 79.93 2 2 8 25 81.14 3 3 9 26 81.21 0 0 10 27 81.82 1 1 11 28 82.83 2 2 12 29 83.54 3 3 Thanks. Xumin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] parsing strings between [ ] in columns
Dear all, I have a data.frame with a column like the x shown below myDF-data.frame(cbind(x=c([[1, 0, 0], [0, 1]], [[1, 1, 0], [0, 1]],[[1, 0, 0], [1, 1]], [[0, 0, 1], [0, 1]]))) myDF x 1 [[1, 0, 0], [0, 1]] 2 [[1, 1, 0], [0, 1]] 3 [[1, 0, 0], [1, 1]] 4 [[0, 0, 1], [0, 1]] As you can see my x column is composed of some strings between [[]], and using colon to separate some fields. I need to identify the numbers of groups inside the main [ ] and call each group with different sequential string. On the example above I would like to have: A B 1 [1, 0, 0] [0, 1] 2 [1, 1, 0] [0, 1] 3 [1, 0, 0] [1, 1] 4 [0, 0, 1] [0, 1] Although here I have only two groups, my real dataset will have much more (~30). After identify the groups I would like to idenfity the subgroups: A1 A2 A3 B1 B2 1 1 0 0 0 1 2 1 1 0 0 1 3 1 0 0 1 1 4 0 0 1 0 1 Any hint are welcome. milton ribeiro [[alternative HTML version deleted]] __ R-help@r-project.org 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] Separating columns, and sorting by rows
Hi Raging Jim may be this is a starting point. myDF-read.table(stdin(),head=T,sep=,) mm,Rainfall 1977-02,17.4 1977-03,34.0 1977-04,26.2 1977-05,42.6 1977-06,58.6 1977-07,23.2 1977-08,26.8 1977-09,48.4 1977-10,47.0 1977-11,37.2 1977-12,15.0 1978-01,2.6 1978-02,6.8 1978-03,9.0 1978-04,46.6 myDF$-substr(myDF$mm,1,4) myDF$mm-substr(myDF$mm,6,7) myDF-subset(myDF, select=c(,mm,Rainfall)) myDF.reshape-reshape(myDF,v.names=Rainfall,idvar=, timevar=mm,direction=wide) myDF.reshape best regards milton [[alternative HTML version deleted]] __ R-help@r-project.org 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] release memory
Try gc() best milton On Mon, Feb 8, 2010 at 5:16 PM, dys0022 dys0...@yahoo.com wrote: I am a new R user with the latest Ubuntu release. My executions consume large amount of memory (up to 1.6 GB). When I try to release the memory using rm(list=ls()), R still occupies 1.6GB. (I also tried to use rm on the specific arrays which I know to be large). What could be the reason for that? BTW I am using the randomForest package. Thanks -- View this message in context: http://n4.nabble.com/release-memory-tp1473643p1473643.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] How to choose seed in set.seed(seed, ...)?
Hi Michael, Experts will answer you better than me, but IMHO there is no best practices. In general you deal with set.seed() when you want that others (or yourself) reproduce the same sequence of random numbers generation as you run on a moment. Best regards milton On Wed, Feb 3, 2010 at 10:57 PM, Michael Hannon jm_han...@yahoo.com wrote: Greetings. I understand that to generate distinct sequences of random numbers in R one can initialize the calculation of each sequence by calling the set.seed() function with a distinct value for seed the (integer) first argument to the function. I'd like to know if there are any guidelines or best practices for choosing seed. I.e., is it OK just to choose seed as any consecutive integers (1, 2, 3, ...), or should the integers be, say, relatively prime (7, 9, 13, ...), or disjoint sequences of digits from pi (14159, 26535, 89793, ...) or ...? Thanks. -- Mike __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] R Output and ArcGIS
Hi Steve, As I have no problem with this because I run windows, I prefere to use .txt files. But may be on your case you install xlsReadWrite (or WriteRead), because .xls file works fine for ArcGis. Remember not use complex (like having dots) or large names because some times you get error on ArcGis. Good luck, milton On Mon, Jan 25, 2010 at 12:54 PM, Steve Murray smurray...@hotmail.comwrote: Dear all, I've been using R on a Mac to process some data for export to ArcMap GIS (which only runs on Windows). ArcMap seems to require tab-delimited data (my data are in 3 columns), so I've been using the sep=\t argument. However, this resulted in strange end-of-line characters when displayed on a PC. I looked in the write.table help file to find that eol=\r\n can be used to get around this problem, and it does indeed prevent these unwanted characters from appearing. However, the data still aren't properly recognised by ArcMap when created on a Mac (the exact same code works fine from a PC). In ArcMap, when I select 'Display XY Data', the X (Longitude) and Y (Latitude) columns aren't available to select. It's as if Arc isn't correctly interpreting the output from R - this is despite me using col.names=TRUE in the write.table command. Any light shed on this will be very gratefully received. Many thanks for your help, Steve _ We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] 3d trend line
Hi mlcarte3 (it is you?) ?contour Try algo google R graph gallery bests milton On Thu, Jan 21, 2010 at 2:43 PM, mlcarte3 mlcar...@ncsu.edu wrote: I have a 3d scatter plot and I need to add a trend line. I can add a regression plane, but I need a line, not a plane. Thanks. -- View this message in context: http://n4.nabble.com/3d-trend-line-tp1053686p1053686.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] What is the difference between S and R?
Hi There, If you are starting with S or R, don't be worried. If you just started (I suppose with R), don't be worried too. Just enjoy and be happy :-) bests milton On Thu, Jan 21, 2010 at 10:44 AM, Peng Yu pengyu...@gmail.com wrote: On Thu, Jan 21, 2010 at 9:07 AM, Giovanni Petris gpet...@uark.edu wrote: I have found a good refernce to be S Programming by Venables and Ripley. I'll take a look at this book. Since S and R are not completely the same, there are delicate differences between S and R, which an S book may be confusing if I want to learn R. One example is Statistical Models in S by Chambers and Hastie, where some examples in this book is not applicable in R as I pointed in my previous message to this mailing list some time ago. Could somebody let me know if there is a detailed comparison between S and R to help me understand R better even if I use books for S? I don't find a tutorial on S3. Bengtsson.pdf cites MASS (1999 edition). However, I don't think that MASS (2002 edition) clearly explain what S3 is and help a user who knew very little about S3 to quickly understand it. Could somebody let me know if there are some better learning materials to help me smooth the learning curve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Giovanni Petris Dept of Mathematical Sciences University of Arkansas definetti.uark.edu/~gpetris (479) 575-6324, 575-8630 (Fax) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] How to write '' to a csv with the default setting of write.csv?
Hi Peng, May be write.table(...,quote=F) bests milton On Thu, Jan 21, 2010 at 6:29 PM, Peng Yu pengyu...@gmail.com wrote: Please see the following example. I can not write '' to a csv file successfully. Could somebody let me if it is possible to write '' to a csv file with the default setting of write.csv? my_home$ Rscript main_quote.R x=rbind( + \A\ + , \B\ + ) x [,1] [1,] \A\ [2,] \B\ write.csv(x, main_quote.csv, row.names=F) my_home$ cat main_quote.csv V1 A B __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] How to write '' to a csv with the default setting of write.csv?
Peng, Are you having doble quotes? It is what you want? Did you tried the suggestion? bests milton On Thu, Jan 21, 2010 at 6:38 PM, Peng Yu pengyu...@gmail.com wrote: On Thu, Jan 21, 2010 at 5:32 PM, milton ruser milton.ru...@gmail.com wrote: Hi Peng, May be write.table(...,quote=F) bests milton Would this cause some trouble when filed is missing, etc.? Although I don't have a concrete example, I think that it might happen. So I prefer to have quote=T. I have looking for a way so that the resulted csv file can be read by excel. http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm#FileFormat On Thu, Jan 21, 2010 at 6:29 PM, Peng Yu pengyu...@gmail.com wrote: Please see the following example. I can not write '' to a csv file successfully. Could somebody let me if it is possible to write '' to a csv file with the default setting of write.csv? my_home$ Rscript main_quote.R x=rbind( + \A\ + , \B\ + ) x [,1] [1,] \A\ [2,] \B\ write.csv(x, main_quote.csv, row.names=F) my_home$ cat main_quote.csv V1 A B __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Logistic regression
Dear someone, Take a look at drc and Hmisc/Design packages. Next time could be polite you identify yourself bests milton On Thu, Jan 21, 2010 at 4:17 PM, DispersionMap frenc...@btinternet.comwrote: can you do Logistic regression in R, if so how do you do it and how do you test the fit of a model? -- View this message in context: http://n4.nabble.com/Logistic-regression-tp1059870p1059870.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] concatenate 2 column vectors
Hi Magali, I confess that I still not figured out what you want, but try this: datatry2=transform(datatry,DIS=as.numeric(as.character(paste(datatry[,1],datatry[,2],sep= bests milton On Wed, Jan 20, 2010 at 11:14 PM, teurlai magali teurlai...@yahoo.frwrote: Sorry I forgot the subject in my previous post Here is an example of data : province and district code of 4 locations datatry=matrix(c(8,12,3,3,1,1,16,1),4,2) colnames(datatry)-c(PROCODE,DISCODE) DISCODE is not unique for each location (there is a distrcit nb 1 in each province) I want to create a third column (DIS) which would contain a unique district code for each location that would be the appended values of the province code and the district code, and that would be a numeric value (not a character) here is my try (thanks to Henrique Dallazuanna!) DIS=rep(0,nrow(datatry)) datatry=cbind(datatry,DIS) datatry2=transform(datatry,DIS=paste(datatry[,1],datatry[,2])); However it creates a string, and the 2 codes are separated by an empty space, which I didn't manage to supress using different values for arguments sep and collapse. i'll try to see other options to concatenate 2 numeric values into a third one. Thanks --- En date de : Jeu 21.1.10, Henrique Dallazuanna www...@gmail.com a écrit : De: Henrique Dallazuanna www...@gmail.com Objet: Re: [R] (no subject) À: teurlai magali teurlai...@yahoo.fr Cc: r-help@r-project.org Date: Jeudi 21 Janvier 2010, 3h41 transform(DF, District_Unique = paste(Province, District, collapse = '')) On Thu, Jan 21, 2010 at 12:34 AM, teurlai magali teurlai...@yahoo.fr wrote: Hi is there a way in R to create a new column vector with the numbers of 2 others columns simply appended? Example : I have a column with provinces codes (1 to 19) I have a second column with districts codes (1 to ##, depending on the province) I want to create a third column with a code that would be unique for each district: Province District District_Unique 1 111 1 212 13 2132 I can create a loop, but it becomes complicated with numerous data Thanks for your help [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] How to detect and exclude outliers in R?
Hi V.S., Did you search first on r-repositories about this issue prior to ask? May be not. RSiteSearch(outliers) bests milton On Tue, Jan 19, 2010 at 1:08 AM, vikrant vikrant.shi...@tcs.com wrote: Suppose I am reading data from a file and the data contains some outliers. I want to know if it is possible in R to automatically detect outliers in a dataset and remove them -- View this message in context: http://n4.nabble.com/How-to-detect-and-exclude-outliers-in-R-tp1017285p1017285.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] how to open excel 2007 (.xlsx) file in R
Dear V.K., 1. http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html 2. it is - in general - good someone that write to the list identify your self. It is a polite way of participate of the list. bests milton On Tue, Jan 19, 2010 at 12:15 AM, vikrant vikrant.shi...@tcs.com wrote: i am unable to open a file which is saved as .xlsx format in R . The file contains approximately 1,50,000 rows. So I m not able to save it as csv file.Please suggest ways to open this file -- View this message in context: http://n4.nabble.com/how-to-open-excel-2007-xlsx-file-in-R-tp1017273p1017273.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] (no subject)
Saleem, I have no idea about this, but may be you can use other data.frame name instead of data because data is a name of a function (see ?data). good luck milton On Fri, Jan 15, 2010 at 3:33 PM, saleem mukhtar saleem...@yahoo.com wrote: Hello, I am running R on cygwin for windows. File R1234 contains data - read.table(data) q() On the command line I type R --no-save -q R_PROFILE=R1234 returns Error: could not find function read.table THanks. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Linear regression - R^2
Dear Csanad, PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html Reproducible code/problem are welcome. By the way, who you believe is right? bests milton On Sat, Jan 9, 2010 at 5:40 PM, Csanád Bertók bertok.csa...@gmail.comwrote: Hello, I was doing a linear regression with the following formula: *lm(y~x+0)*, so it passes through the origin. But when I called the summary of the regression i saw that R squared is abnormally high (it's a lot lower in other programs such as SigmaPlot and MS Excel).The manual explained the cause of the difference (because of the different computing method), but what should I do to get the same R^2 in excel and R? WITHOUT PASSING THROUGH THE ORIGIN: R^2: Multiple R-squared: 0.9711, Adjusted R-squared: 0.9654 In MS Excel: 0,9711 *So it's OK.* WITH PASSING THROUGH THE ORIGIN: Multiple R-squared: 0.9848, Adjusted R-squared: 0.9822 In MS Excel: 0,8907 *So almost 10% difference.* Thank you for your help. Csanad Bertok, Hungary [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] February 2010***New R Courses*** by XLSolutions Corp at 9 USA Cities: San Francisco, New York, Washington DC, Houston, Boston, Las Vegas, Seattle, etc
Dear Sue, Happy new your to you too. You will offer the course on R or S-Plus? If S-plus is the case, how deal with license? bests milton On Wed, Jan 6, 2010 at 3:24 PM, Sue Turner s...@xlsolutions-corp.com wrote: Happy New Year ! XLSolutions February 2010 R courses schedule is now available online at 9 USA cities for with 13 new courses: *** Suggest a future course date/city (1) R-PLUS: A Point-and-Click Approach to R (2) S-PLUS / R : Programming Essentials. (3) R/S+ Fundamentals and Programming Techniques (4) R/S-PLUS Functions by Example. (5) S/R-PLUS Programming 3: Advanced Techniques and Efficiencies. (6) R/S+ System: Advanced Programming. (7) R/S-PLUS Graphics: Essentials. (8) R/S-PLUS Graphics for SAS Users (9) R/S-PLUS Graphical Techniques for Marketing Research. (10) Multivariate Statistical Methods in R/S-PLUS: Practical Research Applications (11) Introduction to Applied Econometrics with R/S-PLUS (12) Exploratory Analysis for Large and Complex Problems in R/S-PLUS (13) Determining Power and Sample Size Using R/S-PLUS. (14) R/S-PLUS: Data Preparation for Data Mining (15) Data Cleaning Techniques in R/S-PLUS (16) R/S-PLUS: Applied Clustering Techniques More on website http://www.xlsolutions-corp.com/rplus.asp Ask for group discount and reserve your seat Now - Earlybird Rates. Payment due after the class! Email Sue Turner: sue at xlsolutions-corp.com Phone: 206-686-1578 Please let us know if you and your colleagues are interested in this class to take advantage of group discount. Register now to secure your seat. Cheers, Elvis Miller, PhD Manager Training. XLSolutions Corporation 206 686 1578 www.xlsolutions-corp.com elvis at xlsolutions-corp.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Fwd: string
Hi Robert, I use something like this with grass-R: myvar-paste(questionspan style=,color: #FF; font-weight: bold; font-size: 14pt,,sep=\) myvar May be it works for you. bests milton On Wed, Jan 6, 2010 at 6:22 AM, robert-mcfad...@o2.pl wrote: I would like to assign a variable y the string: questionspan style=color: #FF; font-weight: bold; font-size: 14pt How can I do it - is it possible? Best, Robert __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] how to draw abline correctly?
You can also try: axis(1) axis(2, las=1) axis(2,at=c(0.1361), las=1) bests milton On Sun, Jan 3, 2010 at 9:26 PM, aegea gche...@gmail.com wrote: Hello, I am frastruated with this graph, just cannot get what I need. Thank you for any suggestions or help. I really appreciate it. I wrote the following code, but there are 3 problems 1, the red line is added on the graph but without any marker on the y-axis. I want to display the number '.1361' on the y-axis. So people can easily tell 'method 2' gets a constant estimate, which is 0.1361. 2, since 'method2' is a constant. I prefer in the legend area, it just shows 'method2' as a short red bar instead of a knot/spot in the middle of the red bar in the legend area. How can I delete that spot? 3, when I draw 'method1' in blue one, I prefer a filled/shaded circle instead of the unshaded circle. I tried pch='.', seems it does not really work. Hopefully I make my question clear. Thanks a lot for any help! size=c(80, 40, 20, 16, 10, 8, 4, 2) estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 , 0.0607) plot(size, estimate, type=o, lwd=1.5, col=blue, ylim=c(0, 0.2), xlim=c(0,80)) abline(h=0.1361, col=red, lwd=1.5) legend(0, 0.2,c(method1,method2), cex=0.8,col=c(blue,red), pch=21:1, lty=1); -- View this message in context: http://n4.nabble.com/how-to-draw-abline-correctly-tp998018p998018.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Artificial Neural Networks
Hi Alex, I am not a NN user, but I would suggestion you give more information about what are you planning to do. May be it helps the helper. Happy New Year. miltinho On Sun, Jan 3, 2010 at 3:54 PM, Alex Olafson alex.olaf...@yahoo.com wrote: Hi! I am studying to use some R libraries which are applied for working with artificial neural neworks (amore, nnet). Can you recommend some useful, reliable and easy to get example data to use in R for creating and testing a neural network? And what library will you advise? __ The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yaho [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] function in aggregate applied to specific columns only
You want this? basicSubMean - aggregate(basicSub[c(score)], by=list(basicSub$student), FUN=mean, na.rm=TRUE) basicSubMean Group.1 score 1 1 55.0 2 2 60.0 3 3 67.5 bests milton On Sun, Jan 3, 2010 at 10:46 PM, david hilton shanabrook dhsha...@acad.umass.edu wrote: I want to use aggregate with the mean function on specific columns gender - factor(c(m, m, f, f, m)) student - c(0001, 0002, 0003, 0003, 0001) score - c(50, 60, 70, 65, 60) basicSub - data.frame(student, gender, score) basicSubMean - aggregate(basicSub, by=list(basicSub$student), FUN=mean, na.rm=TRUE) This doesn't work, one cannot take the mean of a factor (gender). Is there any way of specifying which columns to use for the mean? I want to aggregate by student, obtaining mean scores, and assume any other factors are unchanging in a specific student, ie. gender. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] how to draw abline correctly?
Hi there, May be part of your problem is solved. size=c(80, 40, 20, 16, 10, 8, 4, 2) estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 , 0.0607) plot(size, estimate, type=o, lwd=1.5, col=blue, ylim=c(0, 0.2), xlim=c(0,80), pch=19, axes=F) abline(h=0.1361, col=red, lwd=1.5) legend(0, 0.2,c(method1,method2), cex=0.8, col=c(blue,red), pch=c(19,NA), lty=1); axis(1) axis(2,at=c(0,0.10,0.1361,0.2)) bests milton On Sun, Jan 3, 2010 at 9:26 PM, aegea gche...@gmail.com wrote: Hello, I am frastruated with this graph, just cannot get what I need. Thank you for any suggestions or help. I really appreciate it. I wrote the following code, but there are 3 problems 1, the red line is added on the graph but without any marker on the y-axis. I want to display the number '.1361' on the y-axis. So people can easily tell 'method 2' gets a constant estimate, which is 0.1361. 2, since 'method2' is a constant. I prefer in the legend area, it just shows 'method2' as a short red bar instead of a knot/spot in the middle of the red bar in the legend area. How can I delete that spot? 3, when I draw 'method1' in blue one, I prefer a filled/shaded circle instead of the unshaded circle. I tried pch='.', seems it does not really work. Hopefully I make my question clear. Thanks a lot for any help! size=c(80, 40, 20, 16, 10, 8, 4, 2) estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 , 0.0607) plot(size, estimate, type=o, lwd=1.5, col=blue, ylim=c(0, 0.2), xlim=c(0,80)) abline(h=0.1361, col=red, lwd=1.5) legend(0, 0.2,c(method1,method2), cex=0.8,col=c(blue,red), pch=21:1, lty=1); -- View this message in context: http://n4.nabble.com/how-to-draw-abline-correctly-tp998018p998018.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Question on Reduce + rollmean
Dear M.Rahiz, Unfortunatelly I can't reproduce your example. PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html bests milton On Sat, Jan 2, 2010 at 9:26 AM, Muhammad Rahiz muhammad.ra...@ouce.ox.ac.uk wrote: Hello useRs, I'd like to perform a moving average on the dataset, xx. I've tried combining the functions Reduce and rollmean but it didn't work. r - function(n) rollmean(n, 2) # where 2 = averaging interval output - Reduce(r, x) Error in f(init, x[[i]]) : unused argument(s) (x[[i]]) Is there anything wrong with the code in the first place? where x [[1]] V1 V2 V3 [1,] 1 1 1 [2,] 2 2 2 [3,] 3 3 3 [[2]] V1 V2 V3 [1,] 4 4 4 [2,] 5 5 5 [3,] 6 6 6 [[3]] V1 V2 V3 [1,] 7 7 7 [2,] 8 8 8 [3,] 9 9 9 The moving average is to be performed on 1,4,7 = (1+4)/2 , (4+7)/2 2,5,8 = .. 3,6,9 = .. Thanks Muhammad -- Muhammad Rahiz | Doctoral Student in Regional Climate Modeling Climate Research Laboratory, School of Geography the Environment Oxford University Centre for the Environment, University of Oxford South Parks Road, Oxford, OX1 3QY, United Kingdom Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974 Email: muhammad.ra...@ouce.ox.ac.uk __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] How to use read.table with Hebrew column names ?
Hi Tal, You want the colnames in hebrew? Case not, may be you can use colnames() to attrib new colnames. bests milton On Fri, Jan 1, 2010 at 4:47 PM, Tal Galili tal.gal...@gmail.com wrote: Hello dear R help group, I am trying to read a .txt file, with Hebrew column names, while keeping the column names looking well in R - but without success. I uploaded an example file to: http://www.talgalili.com/files/aa.txt And am trying the command: read.table(http://www.talgalili.com/files/aa.txt;, header = T, sep = \t) This returns me with: X.ª X...ª.. X...Å 1 12 97 6 2 123 35444 3 6 1 3 Instead of: ××ת שת××× ×©××ש 12 97 6 123 354 44 6 1 3 Any suggestion or clarification will be appreciated. Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] How to not to terminate read.table if the input file is empty?
?try() On Fri, Jan 1, 2010 at 3:41 PM, Peng Yu pengyu...@gmail.com wrote: read.table terminates the program if the input file is empty. Is there way to let the program continue and return me a NULL instead of terminating the program? $ Rscript read_empty.R read.table(empty_data.txt) Error in read.table(empty_data.txt) : no lines available in input Execution halted $ cat read_empty.R read.table(empty_data.txt) $ cat empty_data.txt; echo EOF EOF __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] How to calculate density function of Bivariate binomial distribution
Hi Nykee, I checked out ??bivariate on my R installed libraries, and found about a hundred of occurrences of bivariate. If nobody reply you with a streigth answer, give a look at: VGAM; splancs; sm; prada; geoR; fUtilities; fBasics; akima; adehabitat; vegan; ade4 and spatstat packages. bests milton On Fri, Jan 1, 2010 at 5:36 PM, nykee rairai...@hotmail.com wrote: Am trying to do some study on bivariate binomial distribution. Anyone knows if there is package in R that I can use to calculate the density function of bivariate binomial distribution and to generate random samples of it. Thanks, -- View this message in context: http://n4.nabble.com/How-to-calculate-density-function-of-Bivariate-binomial-distribution-tp992002p992002.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Boxplot- input the median point and the median value
Dear Elaine, The posting guide is http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html bests milton On Fri, Jan 1, 2010 at 8:53 PM, elaine kuo elaine.kuo...@gmail.com wrote: Dear, I am a newbie to R. Now I am learning to draw boxplot using graphics(). I want to highlight the median position with a round point and the value left (or on the top of)to the point. Please kindly share the command and thank you. Elaine [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] joining two lists...
Dear Steve, If I undertood you have a list of data.frame?. Have you tried: NewData-rbind(data.frame(myData[1]),data.frame(myData[2])) Please, send us a str(object) so the experts can help you bests milton On Thu, Dec 31, 2009 at 1:05 AM, stevemew steve@alphaedge.org wrote: My R problem.. I want to join two lists but am so for not having any luck. Can anyone assist ? Variable: myData[1] Data.Id Data.Length Data.Weight 1 12 12 2 45 23 Variable: myData[2] Data.Id Data.Length Data.Weight 3 25 56 4 55 288 How do I join them together to get this ? ; Variable: NewData[1] Data.Id Data.Length Data.Weight 1 12 12 2 45 23 3 25 56 4 55 288 I have tried rbind,cbind,append, merge no luck so far... Any help greatly appreciated... Thanks Steve -- View this message in context: http://n4.nabble.com/joining-two-lists-tp991285p991285.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] How x[, 'colname1'] is implemented?
Hi Peng, If I undertood your point, try this: x-runif(10) y-runif(10) z-runif(10) w-runif(10) myDF-data.frame(cbind(x,y,z,w)) myDF myDF[,c(w,z)] Happy new year miltinho On Thu, Dec 31, 2009 at 5:15 PM, Peng Yu pengyu...@gmail.com wrote: I don't see where describes the implementation of '[]'. For example, if x is a matrix or a data.frame, how the lookup of 'colname1' is x[, 'colname1'] executed. Does R perform a lookup in the a hash of the colnames? Is the reference O(1) or O(n), where n is the second dim of x? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Negbin Error Warnings
Dear Clara, could you, please, share the summary() of your data. bests milton 2009/12/30 Clara Brück clara_bru...@web.de Hi, I ran a negative binomial regression (NBR) using the Zelig-package and the negbin model. When I then try to use the simumlation approach using the setx () and sim() functions to calculate expected values and first difference for different levels of one of my independent variables, I get 50 errors warnings, telling me that the calculation rpois produced NAs. However, the data I use doesn't have any NAs. Does this mean that the NBR-model is the wrong model for this data? Thanks in advance. ___ Preisknaller: WEB.DE http://web.de/ DSL Flatrate für nur 16,99 Euro/mtl.! http://produkte.web.de/go/02/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Fwd: Negbin Error Warnings
Dear Clara, Thanks for the reply. I am forwarding your message to the list, ok. When I wrote was a way of get further information to help the helpers. happy holidays, milton -- Forwarded message -- From: Clara Brück clara_bru...@web.de Date: 2009/12/30 Subject: Re: [R] Negbin Error Warnings To: milton ruser milton.ru...@gmail.com Dear Milton, Thanks for your email. I ran the NBR-model and then tried to compute the first differences of some expected values: m3.x1 -setx(m3, advisory=1) m3.x2 -setx(m3, advisory=0) m3.s1 -sim (m3,x=m3.x1, x1=m3.x2) However, I then get 50 error warnings, and there all like this: In rpois(k, (mu * rgamma(k, theta))/theta) : NAs produced Bests Clara -Ursprüngliche Nachricht- Von: milton ruser milton.ru...@gmail.com Gesendet: 30.12.09 15:06:04 An: Clara Brück clara_bru...@web.de CC: r-help@r-project.org Betreff: Re: [R] Negbin Error Warnings Dear Clara, could you, please, share the summary() of your data. bests milton 2009/12/30 Clara Brück clara_bru...@web.de Hi, I ran a negative binomial regression (NBR) using the Zelig-package and the negbin model. When I then try to use the simumlation approach using the setx () and sim() functions to calculate expected values and first difference for different levels of one of my independent variables, I get 50 errors warnings, telling me that the calculation rpois produced NAs. However, the data I use doesn't have any NAs. Does this mean that the NBR-model is the wrong model for this data? Thanks in advance. ___ Preisknaller: WEB.DE http://web.de/ DSL Flatrate für nur 16,99 Euro/mtl.! http://produkte.web.de/go/02/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-http://www.r-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. ___ Preisknaller: WEB.DE http://web.de/ DSL Flatrate für nur 16,99 Euro/mtl.! http://produkte.web.de/go/02/ [[alternative HTML version deleted]] __ R-help@r-project.org 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] (no subject)
Hi Hao, I suggest you try again, starting by read posting guide at footnote of this email. How about a title for the message? How about identify yourself? bests milton On Tue, Dec 29, 2009 at 2:59 PM, Hao Cen h...@andrew.cmu.edu wrote: Hi, I wonder how to pass several functions and their arguments as arguments to a function. For example, the main function is f = function(X ) { process(X) ... process(X) } I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2), g3(X, par3). par1, par2 and par3 are parameters and of different types. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] pass functions and arguments to function
Hi Hao, Ok. Sorry for my last post. bests milton On Tue, Dec 29, 2009 at 3:08 PM, Hao Cen h...@andrew.cmu.edu wrote: Hi, I wonder how to pass several functions and their arguments as arguments to a function. For example, the main function is f = function(X ) { process1(X) ... process2(X) } I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2), g3(X, par3). par1, par2 and par3 are parameters and of different types. I would like to pass g1, g2, g3 and their arguments to f and g1, g2, g3 may appear to be in different orders. So that final effect of the passing is f = function(X ) { process1(X) g1(X, par1) g2(X, par2) g3(X, par3) process2(X) } If I pass g2(X, par2),g3(X, par3), g1(X, par1) to f, I would expect to get the effect of f = function(X ) { process1(X) g2(X, par2) g3(X, par3) g1(X, par1) process2(X) } Appreciate any suggestions. thanks Jeff ps please ignore my previous blank subject email. It was accidentally sent before the letter was completed. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] 2D array of strings
Hi Francesco, Be carefull with create a object named str, because you crash str() function. I don't know if it have implications on any package or functions. bests milton On Mon, Dec 28, 2009 at 4:32 PM, Francesco Napolitano franap...@gmail.comwrote: Sorry for the dumb question, but I couldn't figure this out myself. Consider the following: str - c(abc,def) array(str, c(2,1)) [,1] [1,] abc [2,] def How can i obtain the outcome of the second instruction without specifying the number of rows? Thank you in advance, Francesco. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] help: creating a unified histogram
Hi Yael, Have you tried to find it on google R graph gallery ? bests milton On Sun, Dec 27, 2009 at 2:45 PM, Yael Yohai yael.yo...@gmail.com wrote: Good evening, I would like to put the histograms of several matrices on the same graph, together on a unified histogram (instead of having one bar per value on the x-axis, have multiple bars: one representing each matrix, with different colored bars for example to distinguish between the matrices). I couldn't find a function doing that involving hist, plot nor other plotting functions. Is there a function which does this? Thank you, Yael Yohai (Bioinformatics research) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] aggregate binary response data
?aggregate ? On Thu, Dec 24, 2009 at 7:56 AM, Graham Leask grahamle...@btinternet.comwrote: Dear list I have a response variable coded 0/1 i.e. a binary response. There are 20,000 individual responses that I would like to aggregate into numbers of each category (i.e. 0/1) by group called dn (350 different groups) and by month mth (there are several hundred responses per month. What is the simplest way to perform this operation in R? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] aggregate binary response data
may be ?table ? On Thu, Dec 24, 2009 at 7:56 AM, Graham Leask grahamle...@btinternet.comwrote: Dear list I have a response variable coded 0/1 i.e. a binary response. There are 20,000 individual responses that I would like to aggregate into numbers of each category (i.e. 0/1) by group called dn (350 different groups) and by month mth (there are several hundred responses per month. What is the simplest way to perform this operation in R? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] help in merging
Hi there, You can add a order column on x or y and after use this field to order z. Like z-z[order(z$orderfield),] To generate a order on x or y you can do something like x$xorder-1:nrow(x) cheers milton On Thu, Dec 24, 2009 at 2:26 PM, utkarsh.sing...@global-analytics.comwrote: Hi All, I want to merge two datasets by column ID and I don't want the result to be sorted by ID. I am doing the following: z = merge(x, y, by = ID, sort=F) The result is not sorted by ID. But (as oppose to what I expected) it is not even in the original order of either x or y. Can somebody tell what to do if I wanted it to be in the original order of x. P.S.: As my dataset is very huge and I couldn't find the right subset of the data which explains the above problem, so I can't attach it at the moment. If anybody knows the answer, please reply; or else I will try to get the right subset. Thanks in advance Utkarsh __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] prcomp : plotting only explanatory axis arrows
Dear all, I have a very large dataset (1712351 , 20) and would like to plot only the arrows that represent the contribution of each variables. On the sample below I woild like to plot only the explanatory variables (Murder, Assault..) and not the sites. prcomp(USArrests) # inappropriate prcomp(USArrests, scale = TRUE) prcomp(~ Murder + Assault + Rape, data = USArrests, scale = TRUE) plot(prcomp(USArrests)) summary(prcomp(USArrests, scale = TRUE)) biplot(prcomp(USArrests, scale = TRUE)) Thanks a lot, milton [[alternative HTML version deleted]] __ R-help@r-project.org 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] removing rows with NAs in anywere
Dear all, I have a data.frame with some NAs that can happens anywere, and I would like to keep only rows without NAs. Thanks in advance for your help, and Merry Xmas. myvect-runif(100) myvect[sample(1:100)[1:5]]-NA myDF-data.frame(matrix(myvect,ncol=5)) myDF miltinho [[alternative HTML version deleted]] __ R-help@r-project.org 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] Help,Suggest me some methods to identify tr aining set and test set!!!
Not ellegant.. but... MyDF-data.frame(cbind(x=runif(10), y=rnorm(10))) TrainingSize=5 TrainingSize_list-sample(1:nrow(MyDF))[1:TrainingSize] TrainingSize_list MyDF.training-MyDF[(1:nrow(MyDF) %in% TrainingSize_list),] MyDF.training MyDF.test-MyDF[ ! (1:nrow(MyDF) %in% TrainingSize_list),] MyDF.test bests milton On Mon, Dec 21, 2009 at 9:09 AM, bbslover dlu...@yeah.net wrote: I want to split my whole dateset to training set and test set, building model in training set, and validate model using test set. Now, How can I split my dataset to them reasonally. Please give me a hand, It is better to give me some R code. and I see some ways like using SOM to project whole independents to 2-dimensions and find some to be training set and others are test set. like below. I also want to do this. and my date is in xls accessory. Please help me. and excel file is 218*47 matrix, 47 are indepents. I want to project it to 2D and label the corresponding sample label like that picture below. thank you! http://n4.nabble.com/file/n976245/SOM%2Btraining%2Bset%2Band%2Btest%2Bset.jpg SOM+training+set+and+test+set.jpg http://n4.nabble.com/file/n976245/matlab218x47.xls matlab218x47.xls -- View this message in context: http://n4.nabble.com/Help-Suggest-me-some-methods-to-identify-training-set-and-test-set-tp976245p976245.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] how to import data from excel to R
Hi Sarath, try C:\\Documents and Settings\\admin\\Desktop\\data.txt or C:/Documents and Settings/admin/Desktop/data.txt or yet setwd(your path) mydata-read.table(data.txt) cheers miltinho On Thu, Dec 17, 2009 at 12:24 PM, sta_2...@spectrum.net.in wrote: Hi, I am using R and I want to know how data can be transferred from Excel Spread sheet to R for analyzing. I have done like this mydata-read.table(C:\Documents and Settings\admin\Desktop\data.txt); but its not working how can i do it regards Sarath Sankar V Spectrum Softtech Solution __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] write.csv and col.names=F
?write.table On Thu, Dec 17, 2009 at 6:52 PM, kayj kjaj...@yahoo.com wrote: Hi All, I always have a problem with write.csv when I want the column names to be ignored, when I specify col.names=F, I get a header of V1 V2 V3 V4 etc. for example I tried write.csv(mydata, file=data.csv, quote=FALSE, row.names=F, col.names=F) Warning message: In write.csv(mydata, file = data.csv, quote = FALSE, : attempt to set 'col.names' ignored how can I get rid of this problem ? I do not want the header of V1 V2 V3... to appear in my output file, Thanks -- View this message in context: http://n4.nabble.com/write-csv-and-col-names-F-tp974477p974477.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] help with graphing -- Points in my graph are not apparent, always displayed in steps
Hi Philip, I must confess that I not understood what is the problem. Could you clarify it a little bit more? Cheers miltinho brazil=toronto On Sat, Dec 12, 2009 at 12:39 AM, philip robinson robin...@students.wwu.edu wrote: I am trying to graphically represent a large set of data who's result is not strictly uniform. http://n4.nabble.com/file/n961629/egraph_rules_list_2.png The scatter plot to the left has all of the data rising in steps however I know that there are cases within my data that do not fit the dotted line. temp-edat[edat$R1SC0,,] png(egraph_rules_list_1.png,width=800,height=700,res=72); par(mfrow=c(2,2)); qqplot(x=temp$words,y=temp$R1SC,ylab=With Rules applied SC Shortlist,xlab=Number of Words,col=blue,main=Subordinating Conjunctions\n(Number of Words),type=p); hist(temp$R1SC/temp$words,col=heat.colors(max(temp$R1SC)),main=Subortinating Conjunctions \n/ Number of Words); temp-edat[edat$R1CC0,,] qqplot(x=temp$words,y=temp$R1CC,ylab=With Rules applied CC Shortlist,xlab=Number of Words,col=purple,main=Coordinating Conjunctions\n(Number of Words),type=p); hist(temp$R1CC/temp$words,col=heat.colors(max(temp$R1CC)),main=Coordinating Conjunctions \n/ Number of Words); dev.off(); your help is much appreciated -- View this message in context: http://n4.nabble.com/help-with-graphing-Points-in-my-graph-are-not-apparent-always-displayed-in-steps-tp961629p961629.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] how to creat a matrix
Hi Him. Did you read the Help/Manual in PDF/A Instroduction to R.PDF? MyVect-scan() 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 MyVect MyMat-matrix(MyVect, ncol=5, byrow=T) MyMat bests milton On Fri, Dec 11, 2009 at 10:47 AM, Moohwan Kim kmhl...@gmail.com wrote: Dear R family I am attempting to create a matrix. e.g., 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 How could I write a R program? Later I want to extend it to a N by N case. Thanks in advance best Moohwan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Population Histogram
1. Read the posting guide: http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html 2. Did you installed R? 2.1. Case yes, go to the help, click on Manual in PDF bests miltinho On Wed, Dec 9, 2009 at 1:47 PM, terry johnson terry.johnson@gmail.comwrote: How would I make a population histogram in R from an excel file? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] 4D plotting
Hi Jared, google R graph library 4d or http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=90 bests milton On Sun, Dec 6, 2009 at 7:31 AM, Jared Nance nanc...@phys.washington.eduwrote: Hello list, Thanks in advance for whatever help you can give me. I have a data set that I want to visualize that has four important dimensions (x,y,z,t). What I would like to be able to do is plot the three spatial coordinates using, say, scatterplot3d (or similar), and have the color of the plotted points be determined by the time coordinate. I've tried using scatterplot3d to do this, but without much success. Thanks again. -- Jared Nance University of Washington Center For Experimental Nuclear Physics and Astrophysics nanc...@phys.washington.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] hi there!
Hi Dave, May be a good idea you (1) use subjects avoiding help, Hi there, problem, etc. The list is archived for future search, and nobody with problems with MCMC, Metropholis Hasting algorithm will search Hi there; (2) how about minimum reproducible problem? If you are needing use this kind of stuff (mcmc, more sophisticated distributions) you know you can do better. bests milton On Sun, Dec 6, 2009 at 5:53 AM, dave dan daved...@gmail.com wrote: hi there! how u doin?...hope fine. look, i've a difficulty in simulation especially for the bayesian analysis using R. Using the famous Markov Chain Monte Carlo (MCMC) method, Methropolis hasting algorithm i want to simuate different distrbution like: 1/ Weibull-exponential 2/Gamma-Gamma 3/Poisson-Gamma 4/Normal-Normal 5/Normal-Gamma 6/ Negative binomial - Jeffrey's prior Especially, i need the Gamma-Gamma case. with all due respect, can u please help and send me them b/c i don't have enough reference material to refer and understand in detail. will look for ur posetive response!! thank a lot! Bye! Dave from Ethiopia. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] length of a density curve (or any curve)
hi Sylvain, did you try ?density regards milton On Fri, Dec 4, 2009 at 7:19 AM, sylvain willart sylvain.will...@gmail.comwrote: Hello R users, When I type d - density(MyData$x) I obtain a density object I can plot, But I wonder if there is a way to easily compute the length of the density curve ? ( I imagine I could compute the distances between the 512 equally spaced points using their x and y, but does it exist a smarter way ?) Regards, SW __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] how to seperate a matrix
Hi there, mymat-matrix(c(6,8,1, 5,9,2, 20,10,3, 7,11,4, 8,12,5, 25,13,6, 14,14,7), byrow=T, ncol=3) mymat1-mymat[mymat[,1]mymat[,2],] mymat1 mymat2-mymat[mymat[,1]=mymat[,2],] mymat2 bests milton On Thu, Dec 3, 2009 at 10:12 PM, aegea gche...@gmail.com wrote: Hello, I am working on seperate the matrix to two matrices but got trouble on doing it. Please give me some suggestions on doing this. Thanks a lot! My original matrix m is as follows for example, [,1] [,2] [,3] [1,]681 [2,]592 [3,]20 103 [4,]7 114 [5,]8 125 [6,]25 136 [7,] 14 147 I want to generate two matrix m1 and m2 if m[i, 1] m[i,2], then the row is stored in new matrix m1, (i =1, ..., 7) if m[i,1]=m[i,2], then the row is stored in new matrix m2. m1 supposed to be like: [,1] [,2] [,3] [1,]681 [2,]592 [3,]7 114 [4,]8 125 m2 supposed to be like: [,1] [,2] [,3] [1,]20 103 [2,]25 136 [3,] 14 147 How can I code the if statement? Thank you very much -- View this message in context: http://n4.nabble.com/how-to-seperate-a-matrix-tp948225p948225.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Normal tests disagree?
Hi there, Could you provide a minimum reproducible code, please. Bests milton On Tue, Dec 1, 2009 at 6:11 PM, rkevinbur...@charter.net wrote: If I have data that I feed into shapio.test and jarque.bera.test yet they seem to disagree. What do I use for a decision? For my data set I have p.value of 0.05496421 returned from the shapiro.test and 0.882027 returned from the jarque.bera.test. I have included the data set below. Thank you. Kevin Category,Period,Residual CHILD HATS, WIGS MASKS,1/1/2005,-0.449735723758323 CHILD HATS, WIGS MASKS,2/1/2005,0.281461045050074 CHILD HATS, WIGS MASKS,3/1/2005,0.591383050911335 CHILD HATS, WIGS MASKS,4/1/2005,0.239998659520616 CHILD HATS, WIGS MASKS,5/1/2005,0.00343879474063987 CHILD HATS, WIGS MASKS,6/1/2005,-2.64372061292663 CHILD HATS, WIGS MASKS,7/1/2005,0.381630655290173 CHILD HATS, WIGS MASKS,8/1/2005,-1.79543281552347 CHILD HATS, WIGS MASKS,9/1/2005,1.90631012440313 CHILD HATS, WIGS MASKS,10/1/2005,-0.256232543929779 CHILD HATS, WIGS MASKS,11/1/2005,1.83452602676812 CHILD HATS, WIGS MASKS,12/1/2005,-1.06869719416837 CHILD HATS, WIGS MASKS,1/1/2006,1.04378655286183 CHILD HATS, WIGS MASKS,2/1/2006,0.232655831328322 CHILD HATS, WIGS MASKS,3/1/2006,-0.939084802643773 CHILD HATS, WIGS MASKS,4/1/2006,0.854132879285335 CHILD HATS, WIGS MASKS,5/1/2006,-1.71217066877156 CHILD HATS, WIGS MASKS,6/1/2006,1.28040273099582 CHILD HATS, WIGS MASKS,7/1/2006,-0.386415431325857 CHILD HATS, WIGS MASKS,8/1/2006,-0.769127669783483 CHILD HATS, WIGS MASKS,9/1/2006,-0.810996835089867 CHILD HATS, WIGS MASKS,10/1/2006,0.0477292147635991 CHILD HATS, WIGS MASKS,11/1/2006,0.294672848750557 CHILD HATS, WIGS MASKS,12/1/2006,-0.0841330473924862 CHILD HATS, WIGS MASKS,1/1/2007,0.231663729192233 CHILD HATS, WIGS MASKS,2/1/2007,-0.601790650547443 CHILD HATS, WIGS MASKS,3/1/2007,0.285635768516625 CHILD HATS, WIGS MASKS,4/1/2007,-0.963154959558619 CHILD HATS, WIGS MASKS,5/1/2007,1.52188112949994 CHILD HATS, WIGS MASKS,6/1/2007,-0.826092842933196 CHILD HATS, WIGS MASKS,7/1/2007,1.91937201229077 CHILD HATS, WIGS MASKS,8/1/2007,-0.317789483136924 CHILD HATS, WIGS MASKS,9/1/2007,-0.865011007394312 CHILD HATS, WIGS MASKS,10/1/2007,-0.0281604973711276 CHILD HATS, WIGS MASKS,11/1/2007,-0.123887049811822 CHILD HATS, WIGS MASKS,12/1/2007,-0.0327727730592468 CHILD HATS, WIGS MASKS,1/1/2008,-0.0654939600771254 CHILD HATS, WIGS MASKS,2/1/2008,0.279247739913908 CHILD HATS, WIGS MASKS,3/1/2008,0.167606602923418 CHILD HATS, WIGS MASKS,4/1/2008,0.189533097427477 CHILD HATS, WIGS MASKS,5/1/2008,0.402062194225847 CHILD HATS, WIGS MASKS,6/1/2008,1.97150984262995 CHILD HATS, WIGS MASKS,7/1/2008,-2.27538477532968 CHILD HATS, WIGS MASKS,8/1/2008,1.89091792097945 CHILD HATS, WIGS MASKS,9/1/2008,0.0251732151287081 CHILD HATS, WIGS MASKS,10/1/2008,-0.2349741808124 CHILD HATS, WIGS MASKS,11/1/2008,-0.659332058368173 CHILD HATS, WIGS MASKS,12/1/2008,0.127284768034285 CHILD HATS, WIGS MASKS,1/1/2009,-1.42838560676513 CHILD HATS, WIGS MASKS,2/1/2009,0.617689775286461 CHILD HATS, WIGS MASKS,3/1/2009,-0.034243005247084 CHILD HATS, WIGS MASKS,4/1/2009,-0.304574261133836 CHILD HATS, WIGS MASKS,5/1/2009,0.128679369916751 CHILD HATS, WIGS MASKS,6/1/2009,-0.657479389968652 CHILD HATS, WIGS MASKS,7/1/2009,0.608766068692517 CHILD HATS, WIGS MASKS,8/1/2009,1.92814770869400 CHILD HATS, WIGS MASKS,9/1/2009,-0.172644961366165 CHILD HATS, WIGS MASKS,10/1/2009,-0.453255508263169 CHILD HATS, WIGS MASKS,11/1/2009,-1.09903330959344 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] sort a data frame by a vector
not ellegant.. but... vecDF = data.frame(A1=c(C, A, B)) vecDF$A1.order=1:dim(vecDF) vecDF dataDF = data.frame(A1 = c(B, A, C), A2 = c(1,2,3)) dataDF2-merge(vecDF, dataDF, by=intersect(colnames(vecDF),colnames(dataDF))) dataDF2 dataDF2.ord-dataDF2[order(dataDF2$A1.order),] dataDF2.ord milton On Tue, Dec 1, 2009 at 10:36 PM, Hao Cen h...@andrew.cmu.edu wrote: Hi, I have a a vector and a data frame with two columns vec = c(C, A, B) dataDF = data.frame(A1 = c(B, A, C), A2 = c(1,2,3)) I would like to sort the data frame by column A1 such that the order of elements in A1 is as the same as in vec. After the ordering, the data frame would be A1 A2 C 3 A 2 B 1 Any suggestions would be appreciated. Thanks in advance Jeff [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Ggplot2: Elegant Graphics for Data Analysis (Use R) (2009 Paperback)
I agree with Ista. The book is very interesting. I put my 2cents too. milton On Mon, Nov 30, 2009 at 6:20 PM, Ista Zahn istaz...@gmail.com wrote: Depends on what you want. It's possible to find most of the information contained in the book in other places (the ggplto2 website, Hadley's dissertation, the ggplot2 mailing list archive). Personally I really appreciate having all that information in one place, and in an easy to read format. It's worth it for me. -Ista On Mon, Nov 30, 2009 at 5:35 PM, DispersionMap frenc...@btinternet.com wrote: Is this book worth its dollar? If so, why?, if not, why not? Cheers. -- View this message in context: http://n4.nabble.com/Ggplot2-Elegant-Graphics-for-Data-Analysis-Use-R-2009-Paperback-tp931702p931702.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Arrhenius plot with lattice
Hi Markus, PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html Your example is not reproducible. Help your helper :-) bests miltinho On Wed, Nov 25, 2009 at 5:54 PM, Markus Häge markus_ha...@gmx.de wrote: hello there, I like to print a theoretical function into my data. It would work with panel.curve when it's all normal. but unfortunately it's an arrhenius plot and I need 1000/Temperature(70-300K) at the x-axis. With my data it wasn't a Problem but now I have to add this function to the plot and don't know how to turn around the variable in the function and adapt the plot to this. log(n)=log(f(T^.5))-const/T thanks Markus __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] 11 distinguishable colors
Hi there, I picked it up from r.colors' grass manual: http://colorbrewer2.org/ The code bellow cold be usefull for you explore simbols and colors. x11(900,500) par(mfrow=c(1,2)) x-runif(20) y-runif(20) plot(y~x, type=n) Number.of.symbols-20 for (i in 1:Number.of.symbols) { points(y[i]~x[i], pch=i, cex=1.5) text((x[i]+0.02),y[i], i) } colors.list-colors() Number.of.colors-100 colors.list-colors.list[1:Number.of.colors] plot(0:1,0:1, type=n) for (i in colors.list) { x-runif(1) y-runif(1) text(x,y, i, col=i) } cheers miltinho On Tue, Nov 24, 2009 at 6:01 PM, phoebe kong sityeek...@gmail.com wrote: It should be 11 different groups, not 8. On Tue, Nov 24, 2009 at 3:00 PM, phoebe kong sityeek...@gmail.com wrote: Hi, I want to draw a plot where the data set has 8 different groups. Could you suggest 8 combination of colors and symbols that are distinguishable? If the colors are too close, it would be hard to differentiate from the plot. Thanks, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] (ecological) model sensitivity analysis book
Dear all, I know that my question may be so general, but I would like to know if is there a good book for model sensitivity analysis (applied to ecology?) that use R? Is there any package dedicated to model sensitivity analysis on R? Cheers milton [[alternative HTML version deleted]] __ R-help@r-project.org 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] Presentation of data in Graphical format
Google R graph grallery Google R ggplot2 Google R lattice and good luck milton On Sun, Nov 15, 2009 at 7:48 AM, Sunita22 sunita...@gmail.com wrote: Hello My data contains following columns: 1st column: Posts (GM, Secretary, AM, Office Boy) 2nd Column: Dept (Finance, HR, ...) 3rd column: Tasks (Open the door, Fix an appointment, Fill the register, etc.) depending on the post 4th column: Average Time required to do the task So the sample data would look like PostsDeptTask Average time Office Boy HR Open the door 00:00:09 Secretary FinanceFix an appointment00.00.30 . .. I am trying to represent this data in Graphical format, I tried graphs like Mosaic plot, etc. But it does not represent the data correctly. My aim is to check the amount of time and its variability for groups of tasks Thank you in advance Regards Sunita -- View this message in context: http://old.nabble.com/Presentation-of-data-in-Graphical-format-tp26358857p26358857.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] LINEAR MIXED EFFECT
Hi Ana, you did again :-) require(fortunes) fortune(dog) Firstly, don't call your matrix 'matrix'. Would you call your dog 'dog'? Anyway, it might clash with the function 'matrix'. -- Barry Rowlingson R-help (October 2004) if you call your data data you will crach data() function. cheers milton On Fri, Nov 13, 2009 at 8:30 AM, ANARPCG a.gouvei...@imperial.ac.uk wrote: Douglas Bates-2 wrote: On Thu, Nov 12, 2009 at 10:14 AM, milton ruser milton.ru...@gmail.com wrote: Hi Ana, I am not quite sure if it is the problem, but if you call your data.frame as exp, you will crash exp() function... try use another name for your data.frame. By the way, I suggest you not use attach(). Try something like model-lme(weight~date*diet, data=yourdataframe) good luck and include the random specification in the call to lme, not as a separate assignment. milton On Thu, Nov 12, 2009 at 5:43 AM, ANARPCG a.gouvei...@imperial.ac.uk wrote: Milton's point is dead-on, and I would highly encourage you to give the posting guide a look. That said... you might try na.action = na.omit in your call to... actually, we don't know what function you are using (see first point). Regardless, sounds like you have missing data and na.action is set to na.fail (ie, fail if any missing data). cheers, Dave milton ruser wrote: Dear Ana Golveia, It is completelly impossible someone realise what kind or help you need or what is happening. I suggest you give a look on the posting guide, mainly that part about a minimum reproducible code with self explaining information, etc. Cheers milton On Wed, Nov 11, 2009 at 7:22 AM, ANARPCG a.gouvei...@imperial.ac.uk wrote: CAN ANYONE PLEASE HELP ME WITH THIS i HAVE TO DO A MIXED EFFECT LINEAR MODEL WITH MY DATA DUE TO THE FACT THAT I have pseudoreplication! Although after reading and trying it for several times can get around due to Error in na.fail.default(list(date = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, : missing values in object I uploaded my data file Thank you so much Kind regards AG http://old.nabble.com/file/p26300394/rawoctobercalciumexperiment2.txt rawoctobercalciumexperiment2.txt -- View this message in context: http://old.nabble.com/LINEAR-MIXED-EFFECT-tp26300394p26300394.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html http://www.r-project.org/posting-guide.html http://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html http://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. sorry I am new on this things the point is after trying to run the model all that happens is: exp-read.table(file=file.choose(),header=T) attach(exp) names(exp) [1] group date diet weightthickness length [7] width liplength lipwidth exp$diet=factor(exp$diet,levels=c(zeropercent,tenpercent,twentypercent,thirtypercent,fortypercent,cuttleprecent)) exp=na.omit(exp) library(nlme) random=~date model-lme(weight~date*diet) Error in na.fail.default(list(date = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, : missing values in object I have pseudoreplications due to the fact that the measurements of the replicates have different starting points so I was advised to do lme. I never used it before and I cant get arround with it! the help I wanted from you is to help me to understand how to do a runable model! http://old.nabble.com/file/p26315302/rawoctobercalciumexperiment2.txt rawoctobercalciumexperiment2.txt -- View this message in context: http://old.nabble.com/LINEAR-MIXED-EFFECT-tp26300394p26315302.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html http://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted
Re: [R] refactoring in R
Hi Peng, If that information is preliminary, so I guess you have a more clear problem and may be you are able to state a minimally reproducible code/example with what you really need. Bests milton On Fri, Nov 13, 2009 at 9:30 PM, Peng Yu pengyu...@gmail.com wrote: I'm wondering if there are some tips for refactoring in R. I found the following website, which is still preliminary. Is there any program that can help me do refactoring in R? http://www.r-developer.org/projects/show/refactoring __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] LINEAR MIXED EFFECT
Dear Ana Golveia, It is completelly impossible someone realise what kind or help you need or what is happening. I suggest you give a look on the posting guide, mainly that part about a minimum reproducible code with self explaining information, etc. Cheers milton On Wed, Nov 11, 2009 at 7:22 AM, ANARPCG a.gouvei...@imperial.ac.uk wrote: CAN ANYONE PLEASE HELP ME WITH THIS i HAVE TO DO A MIXED EFFECT LINEAR MODEL WITH MY DATA DUE TO THE FACT THAT I have pseudoreplication! Although after reading and trying it for several times can get around due to Error in na.fail.default(list(date = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, : missing values in object I uploaded my data file Thank you so much Kind regards AG http://old.nabble.com/file/p26300394/rawoctobercalciumexperiment2.txt rawoctobercalciumexperiment2.txt -- View this message in context: http://old.nabble.com/LINEAR-MIXED-EFFECT-tp26300394p26300394.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] trend thresholds on time series
Dear all, I have several response variables estimated from some simulations, and I would like to identify the thresholds for trend changes. Fro example, below I forced two different response behaviours and on x is time unit. x-1:1500 y-x/exp(x^0.2) smaller15-y[y15] y-ifelse(y15,y+rnorm(length(smaller15)), 15+rnorm(1000-length(smaller15), 0, 0.9)) myDF1-data.frame(cbind(x,y)) plot(y~x, data=myDF1) k1-1:10 l1- -65*k1*k1+750*k1-500 k2-12:25 l2-2.6299*k2*k2- 104.39*k2 + 1000 myDF2-data.frame(cbind(k=c(k1,k2),l=c(l1,l2))) plot(l~k, data=myDF2) As one can see, the first simulation we have a non-linear ascendent y-response, and after ~500 time steps the simulation change the behaviour to almost stable results. By other side, on second example I get a fast increasing, subsequent decreasing and ~11 time steps I get a different trend. For the first case I think that segmented package could do the job, and for second case I think that it will not work properly. But as my simulations is for time-series, I was thinking if we can have a ts-like way of identify trend changes on the outcome results. Cheers miltinho University of Sao Paulo, br [[alternative HTML version deleted]] __ R-help@r-project.org 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] counting frequencies across two columns
Hi Jason, As your example is not reproducible, may be something like: myFreq-data.frame(table(articleID, author)) if you want to know only those articles with 1 author, you can try subset(myFreq, Freq==1) or something like. bests milton On Sun, Nov 1, 2009 at 2:20 AM, Jason Priem pr...@email.unc.edu wrote: I've got a data frame describing comments on an electronic journal, wherein each row is a unique comment, like so: commentID author articleID 1 1 smith 2 2 2 jones 3 3 3 andrews 2 4 4 jones 1 5 5 johnson 3 6 6 smith 2 I want know the number of unique authors per article. I can get a table of article frequencies with table(articleID), but I can't figure out how to count frequencies in a different column. I'm sure there's an easy way, but I guess I'm too new at this to find it. Thanks for your help! Jason Priem PhD student, School of Information and Library Science, University of North Carolina-Chapel Hill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] x-y plot as an histogram
Hi Federico, Have you checked google R graph library? bests milton On Thu, Oct 29, 2009 at 3:12 PM, Federico Abascal fedeabas...@yahoo.eswrote: Hi, I am investigating a problem for which I found no solution. I have a matrix with two columns. I have plotted it as an x-y plot (plot(matrix[,1],matrix[,2]) But this is not apropriate for my purposes. I need to group the data in matrix[,1] into groups (as an histogram would do). Then I have to calculate the average of matrix[,2] for each group. Before starting with loops and loops I would like to know if is there some way to do this easily with R. Thanks in advance! Federico __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] rotate levelplot
Hi Kang, Could you send a reproducible sample-code? Bests miltinho On Sat, Oct 24, 2009 at 11:32 PM, Kang Min ngokang...@gmail.com wrote: Hi all, I have a matrix with 5 rows and 10 columns, which represent the grids on a rectangular map. I used the code below to plot, but it gives me the map with the 10 columns as y-axis, and the 5 rows as the x-axis, and the (0,0) point is at the usual bottom left hand corner. My map starts with the (0,0) at the top left hand corner. How can I rotate the map 90 degrees clockwise so the (0,0) starts at the top left? That means I need the 10 columns to be x-axis. I cannot transpose the matrix because the map would be laterally flipped over. levelplot(quadsec.mat, colorkey=list(space=bottom), scales=list (tick.number=10), aspect=c(iso)) Thanks, I'm ready to give more information if needed. Kang Min __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] updating columns using other column as reference
Dear R-gurus, Just supose I have a dara.frame that looks like myDF-read.table(stdin(),head=T,sep=,) codID,namesp,k1,k2,k3,k4 1,spA,2,5,6,3 2,spB,4,5,4,6 3,spC,2,1,5,6 4,spC,5,4,3,2 5,spD,1,2,3,4 6,spE,2,4,3,1 I need to update the columns k1-k4 with the namesp, but considering the math between Kx and codID. My desired output must looks like: codID,namesp,k1,k2,k3,k4 1,spA,spB,spD,spE,spC 2,spB,... 3,spC,... 4,spC,... 5,spD,... 6,spE,... Any help are welcome. cheers milton [[alternative HTML version deleted]] __ R-help@r-project.org 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] updating columns using other column as reference
Amazing. Thanks a lot milton On Mon, Oct 19, 2009 at 12:55 PM, Henrique Dallazuanna www...@gmail.comwrote: Milton, Try this: myDF[grep(k, names(myDF))] - sapply(myDF[grep(k, names(myDF))], function(idx)myDF$namesp[idx]) On Mon, Oct 19, 2009 at 2:03 PM, milton ruser milton.ru...@gmail.com wrote: Dear R-gurus, Just supose I have a dara.frame that looks like myDF-read.table(stdin(),head=T,sep=,) codID,namesp,k1,k2,k3,k4 1,spA,2,5,6,3 2,spB,4,5,4,6 3,spC,2,1,5,6 4,spC,5,4,3,2 5,spD,1,2,3,4 6,spE,2,4,3,1 I need to update the columns k1-k4 with the namesp, but considering the math between Kx and codID. My desired output must looks like: codID,namesp,k1,k2,k3,k4 1,spA,spB,spD,spE,spC 2,spB,... 3,spC,... 4,spC,... 5,spD,... 6,spE,... Any help are welcome. cheers milton [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org 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] Filtering on a dataframe- newbie question
Hi there, Try ?subset ?str may also be useful.. bests milton On Sun, Oct 18, 2009 at 11:10 PM, ANJAN PURKAYASTHA anjan.purkayas...@gmail.com wrote: Hi, newbie question. I have a data-frame with 3 named columns: Name, Obs1, Obs2. The Name column members are made of alphanumeric characters: T1, T2, T3 etc. I would like to acess only that subset of the data-frame with Name == T44. X - dataframe[dataframe$Name=='T44'] does not work. Any ideas on how to do this? I'm sure I'm missing a simple concept here. Thanks, Anjan -- = anjan purkayastha, phd bioinformatics analyst whitehead institute for biomedical research nine cambridge center cambridge, ma 02142 purkayas [at] wi [dot] mit [dot] edu 703.740.6939 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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 that possible to graph 4 dimention plot
How about : google r graph gallery 4d ? abs On Sun, Oct 4, 2009 at 3:31 PM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 04/10/2009 3:14 PM, gcheer3 wrote: Suppose there are 4 variables d is a function of a , b and c I want to know how a, b and c change will make d change It will be straightforward to see it if we can graph the d surface if d is only a function of a and b, I can use 'persp' to see the surface of d. I can easily see at what values of a and b, d will get the maxium or minium or multiple modes, etc But for 4 dimention graph, is there a way to show the surface of d Will use color help contour3d in the misc3d package can do something like that. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Can You Recommend Books for Linear Mixed Models in R
Hi Pat, I am happy with the book Mixed Effects Models and Extensions in Ecology with R by Zuur, Ieno, Walker, Saveliev and Smith. In fact I am reading chapter by chapter, and the reading is very digestible, as well as the examples are quite easy to understand and to be reference for our real world. Cheers milton brazil=toronto On Thu, Oct 1, 2009 at 12:10 PM, Pat Schmitz pschm...@illinois.edu wrote: All I have been looking into the books on performing statistics in R, in particular I am interested in General Linear Mixed Models, for Randomized Complete Block Design Experiments The list I have come away with so far is: Mixed Effects Models in S and S-plus by Pinheiro (2002) http://www.amazon.com/Mixed-Effects-Models-S-S-Plus/dp/0387989579/ref=wl_itt_dp_o?ie=UTF8coliid=I1WXOBRXMHD30Vcolid=38N475HUK5VPJ Linear Models with R by Faraway (2004) http://www.amazon.com/Linear-Models-Texts-Statistical-Science/dp/1584884258/ref=sr_1_1?ie=UTF8s=booksqid=1254412763sr=1-1 Extending the Linear Model with R by Faraway (2005) http://www.amazon.com/Extending-Linear-Model-Generalized-Nonparametric/dp/158488424X/ref=pd_sim_b_7 Which of these would you as statisticians, researchers, scientists most recommend? Are there others in this realm of statistics that I have not discovered, that might be more effective? Thanks Pat -- Patrick Schmitz Graduate Student Plant Biology 1206 West Gregory Drive RM 1500 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Deleting a column in a dataframe by name
May be this: FRAME - FRAME[-c(NAME1, NAME2)] or FRAME- subset(FRAME, select=(-NAME1, -NAME2)) bests milton On Tue, Sep 29, 2009 at 4:12 PM, Dennis Fisher fis...@plessthan.com wrote: Colleagues, Hopefully a simple problem: I want to delete a column with a known name from a dataframe. I could write: FRAME - FRAME[, names(FRAME) != NAMETODELETE] or FRAME - FRAME[, !names(FRAME) %in% c(NAME1, NAME2, ETC)] Is there some simpler means to accomplish this? Dennis Dennis Fisher MD P (The P Less Than Company) Phone: 1-866-PLessThan (1-866-753-7784) Fax: 1-415-564-2220 www.PLessThan.com http://www.plessthan.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Deleting a column in a dataframe by name
x=runif(12) y=runif(12) w=runif(12) mydf-data.frame(cbind(x,y,w)) head(mydf) mydf-subset(mydf, select=c(-x,-w)) head(mydf) On Tue, Sep 29, 2009 at 4:27 PM, Rolf Turner r.tur...@auckland.ac.nzwrote: On 30/09/2009, at 9:15 AM, milton ruser wrote: May be this: FRAME - FRAME[-c(NAME1, NAME2)] or FRAME- subset(FRAME, select=(-NAME1, -NAME2)) This is ridiculous advice. Try things out before you suggest them. cheers, Rolf Turner ## Attention: This e-mail message is privileged and confidential. If you are not the intended recipient please delete the message and notify the sender. Any views or opinions presented are solely those of the author. This e-mail has been scanned and cleared by MailMarshal www.marshalsoftware.com ## [[alternative HTML version deleted]] __ R-help@r-project.org 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] Deleting a column in a dataframe by name
Peace on your heart... it is still Tuesday, and Friday is away... :-) On Tue, Sep 29, 2009 at 4:54 PM, Rolf Turner r.tur...@auckland.ac.nzwrote: On 30/09/2009, at 9:32 AM, milton ruser wrote: x=runif(12) y=runif(12) w=runif(12) mydf-data.frame(cbind(x,y,w)) head(mydf) mydf-subset(mydf, select=c(-x,-w)) head(mydf) But this doesn't work if NAME1 and NAME2 are ***names***, as the terminology would apply. And that is precisely the situation in which one would wish to apply this sort of technique. cheers, Rolf Turner On Tue, Sep 29, 2009 at 4:27 PM, Rolf Turner r.tur...@auckland.ac.nz wrote: On 30/09/2009, at 9:15 AM, milton ruser wrote: May be this: FRAME - FRAME[-c(NAME1, NAME2)] or FRAME- subset(FRAME, select=(-NAME1, -NAME2)) This is ridiculous advice. Try things out before you suggest them. cheers, Rolf Turner ## Attention: This e-mail message is privileged and confidential. If you are not the intended recipient please delete the message and notify the sender. Any views or opinions presented are solely those of the author. This e-mail has been scanned and cleared by MailMarshal www.marshalsoftware.com ## ## Attention:This e-mail message is privileged and confidential. If you are not theintended recipient please delete the message and notify the sender.Any views or opinions presented are solely those of the author. This e-mail has been scanned and cleared by MailMarshal www.marshalsoftware.com ## [[alternative HTML version deleted]] __ R-help@r-project.org 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] Count number of zeros in a collumn
Hi Marcio, How about if (min(dart[,1977])==0)... cheers milton On Sun, Sep 27, 2009 at 4:54 PM, Marcio Resende mresende...@yahoo.com.brwrote: I have a matrix 700x2000 which is sampled in each cycle from another matrix 788x2000 with the numbers 0,1 and 9 There is one specific collumn of this matrix, dart[,1977], that usually, after the samplimg procedure has only 1 and 9 (because the zero frequency in this collumn is low). However, when this happens, I want to include an IF conditional in my code. so basically what i wanted to do was to count the number of zeros in this collumn to use this information in my conditional: something like: if (the number of zeros in collumn [,1977] is zero) ... else ... I tried to find out indirectly by the rowsum but because of the sampling procedure the rowsum is not always the same Thank you very much -- View this message in context: http://www.nabble.com/Count-number-of-zeros-in-a-collumn-tp25637516p25637516.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Teach me how to transpose in R
*Hum* bbb=t(as.matrix(data2)) ? good luck milton On Sun, Sep 27, 2009 at 12:39 AM, Hyo Lee totem...@gmail.com wrote: Hi guys, I need your help!! My goal is to make a csv file from ncdf file. This is the code i've used : hyo=open.ncdf(C:/CRUTEM3.nc) hyo [1] file C:/CRUTEM3.nc has 4 dimensions:[1] longitude Size: 72 [1] latitude Size: 36 [1] unspecified Size: 1 [1] t Size: 1916 [1] [1] file C:/CRUTEM3.nc has 1 variables: [1] float temp[longitude,latitude,unspecified,t] Longname:Temperature T Missval:2.0004008175e+20 data2=get.var.ncdf(hyo) write.csv(data2,file=C:/ple.csv) But the problem is, I expected this data would be 17000 * 72 (row* col) ; but, it is the other way around. 72*17000 Because the maximum col number in excel is 16383, this cvs file doesn't show all data. Obviously, I need to transpose the matrix.. I tried to use transpose function but failed. bbb=t(data2) Error in t.default(data2) : argument is not a matrix ccc=t(hyo) ccc [1] file has dimensions: Error in if (nc$ndims 0) for (i in 1:nc$ndims) { : argument is of length zero Teach me how to deal with this problem. Thank you very much. -Hyo [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Create directory and copy files in R
Tammy Try avoid directories with spaces... may be this solve your problem. Case not, write us again. bests milton On Mon, Sep 21, 2009 at 10:05 AM, Tammy Ma metal_lical...@live.com wrote: HI, All R users, My problem is: fn [1] C:/Documents and Settings/lma/Desktop/FamilyAEntrepreneurs/Entrepreneurs/Juha/book_log-20041210T095019.txt dpath [1] C:/Documents and Settings/lma/My Documents/Juha/book I want to make a function cyfun to copy all files in dir to deskdir but I always got the following problem: Error in file.exists(to) : invalid 'file' argument. Whats the problem?? cyfun-function(fn,dpath){ dir-dirname(fn) fn-basename(fn) deskdir-dir.create(dpath) file.copy(fn, deskfile) } Thanks! Tammy _ Drag n dropGet easy photo sharing with Windows Live Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Superimposing (aligning) two graphs
Hi Maggie: 1) plot() combined with lines() may do the job. 2) google R graph gallery bests milton On Tue, Sep 22, 2009 at 5:23 PM, Maggie la.f...@gmail.com wrote: Hello, I need to superimpose two graphs (plotted representations of waver files) so I can see how much they align. Is there a quick and dirty way to do it in R? thanks so much for your help! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Correlate two time series
Have you looked at ts() ? On Tue, Sep 22, 2009 at 5:49 PM, Maggie la.f...@gmail.com wrote: I was wondering how to correlate two time series in R? I have to plotted waver files I need to correlate to one another to see how well they align.. Any guidance would be very much appreciated! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] plotting least-squares regression against x-axis
By the way, how about: plot(y,mylm$residuals) So you can have an idea of your error distribution across your response variable domain. :-) milton toronto=brazil On Sat, Sep 19, 2009 at 9:02 PM, Sunil Suchindran sunilsuchind...@gmail.com wrote: x - seq(50) y - 10 + x * 2 + rnorm(50,0,10) plot(y~x) mylm = lm(y~x) # Use str(mylm) to see how to get the residuals plot(x,mylm$residuals) On Sat, Sep 19, 2009 at 8:35 PM, Jason Priem pr...@email.unc.edu wrote: Hi, I want to plot the residuals of a least-squares regression. plot(lm(y~x), which=1) does this, but it plots the y-axis of my data on the x-axis of the residuals plot. That is, it plots the residual for each y-value in the data. Can I instead use the x-axis of my data as the x-axis of the residuals plot, showing the residual for a given x? Thanks! Jason Priem University of North Carolina at Chapel Hill School of Information and Library Science __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html http://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] (no subject)
Hi Karen, As you are just starting (I guess), I suggest you take a shortcut: 1. copy and paste the data from Excel to the notepad, and save it as .TXT 2. If all is ok, you will have a tab-delimited file. 3. Be sure that your variables have its names on first line 4. read your data using setwd(c:\\temp) myDF-read.table(myfile.txt, head=T, sep=\t) myDF #here you will see all your data.frame (i.e. your table) hist(myDF$VARNAME) or hist(myD[,1]) #to plot 1st collumn hist(myD[,2]) #to plot 2nd collumn good luck.. milton On Sun, Sep 13, 2009 at 7:44 PM, Karen Federico kfede...@stevens.eduwrote: How would I make a histogram using R from a table in excel that has 4 variables, but I only want to use 2 of the columns to make the histogram? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] fitting nonlinear model
Hi Bill, I am not sure what you want, but... mydf-read.table(stdin(), head=T, sep=,) Np,year 96,2 91,5 89,7 85,10 plot(Np~year, data=mydf) mymodel-lm(Np~year, data=mydf) abline(mymodel, col=red) bests milton On Wed, Sep 9, 2009 at 2:27 PM, Bill Hyman billhym...@yahoo.com wrote: My data look like: Np year 962 915 897 85 10 - Original Message From: Bill Hyman billhym...@yahoo.com To: r-help@r-project.org Sent: Wednesday, September 9, 2009 11:23:26 AM Subject: [R] fitting nonlinear model I only have 4 data points and want to fit a curve. It does not work in modreg due to too few data. Do you have any idea? Many thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] fitting nonlinear model
May be this: mydf-read.table(stdin(), head=T, sep=,) Xvar,Yvar 0,1 2,0.9 5,0.5 7,0.1 10,0.01 mymodel-loess(Yvar~Xvar, data=mydf) plot(mymodel) mydf.new-data.frame(cbind(Xvar=seq(from=0, to=10, by=0.1))) mydf.new$Yvar-predict(mymodel, newdata=mydf.new) lines(Yvar~Xvar, data=mydf.new, lty=2) cheers milton On Wed, Sep 9, 2009 at 3:01 PM, milton ruser milton.ru...@gmail.com wrote: Hi Bill, I am not sure what you want, but... mydf-read.table(stdin(), head=T, sep=,) Np,year 96,2 91,5 89,7 85,10 plot(Np~year, data=mydf) mymodel-lm(Np~year, data=mydf) abline(mymodel, col=red) bests milton On Wed, Sep 9, 2009 at 2:27 PM, Bill Hyman billhym...@yahoo.com wrote: My data look like: Np year 962 915 897 85 10 - Original Message From: Bill Hyman billhym...@yahoo.com To: r-help@r-project.org Sent: Wednesday, September 9, 2009 11:23:26 AM Subject: [R] fitting nonlinear model I only have 4 data points and want to fit a curve. It does not work in modreg due to too few data. Do you have any idea? Many thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Joining Characters in R {issue with paste}
You not tryed ?paste :-) paste(a,b,sep=) bests milton On Wed, Sep 9, 2009 at 5:08 PM, Abhishek Pratap abhishek@gmail.comwrote: Hi Guys I am want to join to strings in R. I am using paste but not getting desirable result. For the sake of clarity, a quick example: a=Bio b=iology paste(a,b) [1] Bio iology *There is a SPACE in the word biology which is what I dont want * Thanks, -Abhi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] (no subject)
Hi Roslina, x-runif(1000,min=0, max=600) hist(x) x2-ifelse(x=300,x,300) summary(x2) hist(x2, ,breaks = c(0,50,100,150,200,250,300)) good luck milton On Mon, Sep 7, 2009 at 12:51 AM, Roslina Zakaria zrosl...@yahoo.com wrote: Hi r-users, I would like to know how to put all the data that is greater than certain value in certain cell for my histogram. For example, since maximum value of p1 is 588 it doesn't fit in the breaks that we specified. Can we write breaks 300? max(p1[,2]) pre.hist - hist(p1[,2],breaks = c(0,50,100,150,200,250,300),right=FALSE) max(p1) [1] 587.2761 pre.hist - hist(p1[,2],breaks = c(0,50,100,150,200,250,300),right=FALSE) Error in hist.default(p1[, 2], breaks = c(0, 50, 100, 150, 200, 250, 300), : some 'x' not counted; maybe 'breaks' do not span range of 'x' max(p1[,2]) [1] 587.2761 Thank you. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] (no subject)
May be you also want: x-runif(1000,min=0, max=600) x3-x[x=300] summary(x3) hist(x3, ,breaks = c(0,50,100,150,200,250,300)) bests milton On Mon, Sep 7, 2009 at 1:01 AM, milton ruser milton.ru...@gmail.com wrote: Hi Roslina, x-runif(1000,min=0, max=600) hist(x) x2-ifelse(x=300,x,300) summary(x2) hist(x2, ,breaks = c(0,50,100,150,200,250,300)) good luck milton On Mon, Sep 7, 2009 at 12:51 AM, Roslina Zakaria zrosl...@yahoo.comwrote: Hi r-users, I would like to know how to put all the data that is greater than certain value in certain cell for my histogram. For example, since maximum value of p1 is 588 it doesn't fit in the breaks that we specified. Can we write breaks 300? max(p1[,2]) pre.hist - hist(p1[,2],breaks = c(0,50,100,150,200,250,300),right=FALSE) max(p1) [1] 587.2761 pre.hist - hist(p1[,2],breaks = c(0,50,100,150,200,250,300),right=FALSE) Error in hist.default(p1[, 2], breaks = c(0, 50, 100, 150, 200, 250, 300), : some 'x' not counted; maybe 'breaks' do not span range of 'x' max(p1[,2]) [1] 587.2761 Thank you. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] to istall packages such as 'stats'
Hi Ajay, To install new packages try: install.packages(package_name, dependencies=T) But stats is part of base R. :-) bests miltinho On Thu, Sep 3, 2009 at 6:01 AM, Ajay Singh ajayvi...@yahoo.co.in wrote: Dear All, I have to install 'stats' package in my windows machine, could you let me know how to install the package? Look forward to your assistance, Ajay. - Ajay Singh, Ph.D. |Tel: +91-22 25764785 Research Scientist, |Fax: 091-22-25722872 S.J.M. School of Management,|Telex:011-71923 IITB IN INDIA. | See the Web's breaking stories, chosen by people like you. Check [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] variable selection in logistic
Hi Annie, What kind of data (response and explanatory) you have? As a ecological modeller, I always think first what is my (our) mind models. After that I analyze a set of concorrent - *but with ecological meaning* - models. It helps me to test hypothesis as well as to discuss the results. If you lump your data, they will tell you anything, and you will find a `why` for every results (positive or negative, good or bad)... good luck miltinho On Thu, Sep 3, 2009 at 4:20 PM, annie Zhang annie.zhang2...@gmail.comwrote: Hi, Frank, If I want to do prediction as well as to select important predictors, which may be the best function to use when I have 35 samples and 35 predictors (penalized logistic with variable selection)? I saw there is a 'fastbw' function in the Design package. And there is a 'step.plr' function in the 'stepPlr' package. Thank you, Annie On Thu, Sep 3, 2009 at 10:11 AM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: annie Zhang wrote: Thank you for all your reply. Actually as Bert said, besides predicion, I also need variable selection (I need to know which variables are important). As far as the sample size and number of variables, both of them are small around 35. How can I get accurate prediction as long as good predictors? Annie It is next to impossible to find a unique list of 'important' variables without having 50 times as many subjects as potential predictors, unless your signal:noise ratio is stunning. Frank On Thu, Sep 3, 2009 at 8:28 AM, Bert Gunter gunter.ber...@gene.com mailto: gunter.ber...@gene.com wrote: But let's be clear here folks: Ben's comment is apropos: As many variables as samples is particularly scary. (Aside -- how much scarier then are -omics analyses in which the number of variables is thousands of times the number of samples?) Sensible penalization (it's usually not too sensitive to the details) is only another way of obtaining a parsimonious model with good (in the sense of minimizing overall prediction error: bias + variance) prediction properties. Alas, this is often not what scientists want: they use variable selection to find the right covariates, the most important variables affecting the response. But this is beyond the power of empirical modeling here: as many variables as samples almost guarantees that there will be many different and even nonoverlapping subsets of variables that are, within statistical noise, equally optimal predictors. That is, variable selection in such circumstances is just a pretty sophisticated random number generator -- ergo Frank's Draconian warnings. Penalization produces better prediction engines with better properties, but it cannot overcome the as many variables as samples problem either. Entropy rules. If what is sought is a way to determine the truly important variables, then the study must be designed to provide the information to do so. You don't get something for nothing. Cheers, Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org mailto:r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org mailto:r-help-boun...@r-project.org] On Behalf Of Frank E Harrell Jr Sent: Wednesday, September 02, 2009 9:07 PM To: annie Zhang Cc: r-help@r-project.org mailto:r-help@r-project.org Subject: Re: [R] variable selection in logistic annie Zhang wrote: Hi, Frank, You mean the backward and forward stepwise selection is bad? You also suggest the penalized logistic regression is the best choice? Is there any function to do it as well as selecting the best penalty? Annie All variable selection is bad unless its in the context of penalization. You'll need penalized logistic regression not necessarily with variable selection, for example a quadratic penalty as in a case study in my book, or an L1 penalty (lasso) using other packages. Frank On Wed, Sep 2, 2009 at 7:41 PM, Frank E Harrell Jr f.harr...@vanderbilt.edu mailto:f.harr...@vanderbilt.edu mailto:f.harr...@vanderbilt.edu mailto:f.harr...@vanderbilt.edu wrote: David Winsemius wrote: On Sep 2, 2009, at 9:36 PM, annie Zhang wrote: Hi, R users, What may be the best function in R to do variable selection in logistic regression? PhD theses, and books by famous statisticians have been pursuing the answer to that question for decades. I have the same number of variables as the
Re: [R] Easy way to get top 2 items from vector
Hi Noah, Next time try, please, send a short reproducible code/example. May be this can be (not so elegant but) helpfull myDF-data.frame(cbind(a=runif(5),b=runif(5))) myDF N=2 a.order-rev(order(myDF$a))[1:N] b.order-rev(order(myDF$b))[1:N] myDF.max2a-myDF[a.order,] myDF.max2a myDF.max2b-myDF[b.order,] myDF.max2b milton On Thu, Sep 3, 2009 at 7:17 PM, Noah Silverman n...@smartmediacorp.comwrote: Hi, I use the max function often to find the top value from a matrix or column of a data.frame. Now I'm looking to find the top 2 (or three) values from my data. I know that I could sort the list and then access the first two items, but that seems like the long way. Is there some way to access max_2 or similar? Thanks! -- Noah __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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.