Re: [R] Problems in Recommending R
Patrick Connolly wrote: On Sun, 01-Feb-2009 at 11:34PM -0500, Stavros Macrakis wrote: | A first step that would make the current Web page look much better | would be to anti-alias the demonstration graphic. The current graphic | makes R graphics seem (falsely!) to be very primitive. I'm afraid I | don't know how to do the anti-aliasing myself. | | Replacing the fixed-width, typewriter-style font with something a bit | more elegant might also be good I'd say it would not be good. Fixed-width fonts are desirable when it's for code (of any language). not necessarily. when you do not need clearly visible number of spaces in indents or formats, why care. very many books on programming could have a better look had the authors (or editors) not insisted on having the code in fixed-width. in most cases i write my code with variable-width font, and it feels much better to my eyes. it's just a matter of taste, perhaps ask psychologists if you really want it quantified before making a grounded decision. vQ The example www.knime.org site uses proportional fonts for R code which makes it hard to read IMHO. I really dislike that. What's wrong with a spartan look? Google has flourished with a no-unnecessaries approach to home page clutter. -- --- Wacek Kusnierczyk, MD PhD Email: w...@idi.ntnu.no Phone: +47 73591875, +47 72574609 Department of Computer and Information Science (IDI) Faculty of Information Technology, Mathematics and Electrical Engineering (IME) Norwegian University of Science and Technology (NTNU) Sem Saelands vei 7, 7491 Trondheim, Norway Room itv303 Bioinformatics Gene Regulation Group Department of Cancer Research and Molecular Medicine (IKM) Faculty of Medicine (DMF) Norwegian University of Science and Technology (NTNU) Laboratory Center, Erling Skjalgsons gt. 1, 7030 Trondheim, Norway Room 231.05.060 __ 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] See source code for survplot function in Design package
Marc Schwartz marc_schwartz at comcast.net writes: getAnywhere(function.method) Which also works without the getAnywhere(xtabs) getAnywhere(xtabs) Dieter __ 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] A way to lock down the order of bars for ggplot dodgedhistogram
Hmm, I had not tested my solution. But that used to work. But I'm getting the same result as you do. So maybe this is a bug in ggplot2. Is it, Hadley? Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey Van: Jason Rupert [mailto:jasonkrup...@yahoo.com] Verzonden: donderdag 5 februari 2009 17:44 Aan: R-help@r-project.org; ONKELINX, Thierry CC: ggpl...@googlegroups.com Onderwerp: RE: [R] A way to lock down the order of bars for ggplot dodgedhistogram Thierry, Thank you for such a quick response. I changed the code, but I seem to get the same response. Ugh. Maybe I am missing a step. Thank you again for any feedback. Me_df-data.frame(Data = c(1:15), Person = Me) You_df-data.frame(Data = c(10:20), Person = You) Them_df-data.frame(Data = c(15:25), Person = Them) Group_df_tmp-rbind(Me_df,You_df) Group_df-rbind(Group_df_tmp,Them_df) Group_df$Person - factor(Group_df$Person, levels = c(Them, You, Me)) counts - ddply(Group_df, .(cut(Data, breaks=fullseq(range(Data), 5)), Person), nrow) names(counts) - c(Bin, Person, Frequency) qplot(Person, Frequency, data = counts, fill = Person, geom=bar, stat=identity, width = 0.9, xlab=Person) + facet_grid(. ~ Bin) --- On Thu, 2/5/09, ONKELINX, Thierry thierry.onkel...@inbo.be wrote: From: ONKELINX, Thierry thierry.onkel...@inbo.be Subject: RE: [R] A way to lock down the order of bars for ggplot dodgedhistogram To: jasonkrup...@yahoo.com, R-help@r-project.org Cc: ggpl...@googlegroups.com Date: Thursday, February 5, 2009, 10:17 AM Dear Jason, Convert Person to a factor with the levels in the order that you want. Group_df$Person - factor(Group_df$Person, levels = c(Them, You, Me)) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Jason Rupert Verzonden: donderdag 5 februari 2009 17:09 Aan: R-help@r-project.org CC: ggpl...@googlegroups.com Onderwerp: [R] A way to lock down the order of bars for ggplot dodgedhistogram It appears that ggplot reorder the data for a dodged histogram based on whether or not a specific variable has a value in the first bin. I would like to be able to absolutely force the order of the variables in the bin. For example, say I have three variables Me, You, and Them. Me_df-data.frame(Data = c(1:15), Person = Me) You_df-data.frame(Data = c(10:20), Person = You) Them_df-data.frame(Data = c(15:25), Person = Them) Group_df_tmp-rbind(Me_df,You_df) Group_df-rbind(Group_df_tmp,Them_df) counts - ddply(Group_df, .(cut(Data, breaks=fullseq(range(Data), 5)), Person), nrow) names(counts) - c(Bin, Person, Frequency) qplot(Person, Frequency, data = counts, fill = Person, geom=bar, stat=identity, width = 0.9, xlab=Person) + facet_grid(. ~ Bin) However, I absolutely must have the bar order be Them, You, Me.
[R] Variance of AR-Process.
Hello. How can I calculate the theoretical process variance of an AR-Process in R? Is there a specific function given in any R package? Regards, Andreas. __ 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] Legend for radial.plot?
Jason Rupert wrote: Using plotrix, is it possible to create a legend for the following and attach it to the radial.plot? posmat-matrix(sample(2:9,30,TRUE),nrow=3) radial.plot(posmat,labels=paste(X,1:10,sep=),rp.type=p, main=Spiderweb plot,line.col=2:4,show.grid=FALSE,lwd=1:3, radial.lim=c(0,10)) par(xpd=TRUE) legend(5,-8,c(Red,Green,Blue),lty=1,lwd=1:3,col=2:4) par(xpd=FALSE) Jim __ 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] Linear model: contrasts
Hey, I am modelling a linear regression Y=X*B+E. To compute the effect of “group” the B-values of the regressors/columns that code the interaction effects (col. 5-8 and col. 11-14, see below) have to be weighted with non-zero elements within the contrast Group 1 minus Group 2 (see below). My first understanding was that the interaction effects add up to zero in each group. Why do they get non-zero contrast weights? Do you recommend any literature discussing this topic? Many Thanks, Stefan The columns of matrix X dummy-codes 1. Data of Group1 (G1) 2. Data of Group2 (G2) 3. Data condition A1 (factor A) 4. Data condition A2 (factor A) 5. Data in cell A1G1 6. Data in cell A2G1 7. Data in cell A1G2 8. Data in cell A2G2 9. Data condition B1 (factor B) 10. Data condition B2 (factor B) 11. Data in cell B1G1 12. Data in cell B2G1 13. Data in cell B1G2 14. Data in cell B2G2 15. Mean Example: #create X dimnames = list( paste(sub,c(1:8)), c(Group1,Group2,A1,A2,A1G1,A2G1, A1G2,A2G2,B1,B2, B1G1,B2G1, B1G2,B2G2,mean )) X=matrix(nrow=8,ncol=15,dimnames=dimnames) X[,1]= c(rep(1,4), rep(0,4)) X[,2]=c(rep(0,4),rep(1,4)) X[,3]=c(1,1,0,0,1,1,0,0); X[,4]=c(0,0,1,1,0,0,1,1); X[,5]=c(1,1,0,0,0,0,0,0); X[,6]=c(0,0,1,1,0,0,0,0); X[,7]=c(0,0,0,0,1,1,0,0); X[,8]=c(0,0,0,0,0,0,1,1); X[,9]=c(1, 0, 1, 0, 1, 0,1, 0); X[,10]=c(0, 1, 0, 1, 0, 1, 0, 1); X[,11]=c(1, 0, 1, 0,0, 0, 0, 0); X[,12]=c( 0, 1, 0, 1,0, 0, 0, 0); X[,13]=c( 0, 0, 0, 0, 1, 0, 1, 0) X[,14]=c(0, 0, 0, 0,0, 1, 0, 1) X[,15]=c(1,1,1,1,1,1,1,1) #y data Y=c(1.2,5.1,1.7,7,6.1,8,1.1,2.5) library(MASS) ginv() B=(ginv(t(X)%*%X) %*% t(X)) %*% Y #contrast c1=rep(0,15) c1[1]=1 c1[c(5,6,11,12)]=1/2 c2=rep(0,15) c2[2]=-1 c2[c(7,8,13,14)]=-1/2 #Group effect mean(Y[1:4])-mean(Y[5:8]) c1%*%B+c2%*%B -- -- Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a __ 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] R on Mobile Devices (Android)
Hell R-list, At the cost of sounding far-fetched and almost incredulous, I would like to know if any R user is remotely considering the use of R on Mobile devices, and Android in particular. I really do not have an idea of the kind of definite incentives in terms of using R on Android, but having an analytical engine on a mobile phone would allow for micro statistics to be collected from the log files reflecting number of calls dropped, average time spent talking, a time series of the amount of time taken for battery recharge, and a host of other information that could be collated and analyzed. R widgets could be created for analyzing the data streams from other apps running on the same device. Any thoughts/suggestions/information on this topic will be highly appreciated. Thanks Harsh Singhal Decision Systems Mu Sigma Inc. Chicago, IL __ 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] R training
Hi there, does anybody know of a good R training course or has participated in one? Maybe also a good lecture or course at a university, where the teacher might be willing to offer a course? Audience: = 3 - 5 natural scientists with programming and rudimentary statistical knowledge Location: = Freiburg im Breisgau, Germany (i. e. inhouse-training or training in/near Freiburg) Duration and date: == 1 to max. 3 days in spring 2009 Regards, Florian. -- __ 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] Rmpi with LAM/MPI on Debian
Hello, I seem to be unable to get Lam/Mpi to work with Rmpi on Debian 5. Following the readme file, I installed the packages r-cran-rmpi and lam3 lam3-dev lam-runtime . The lam-bhost.def is configured like this: hn01 cn01 cpu=4 cn02 cpu=4 Lam seems to be fine with this: lamboot -v n-113746 ssi:boot:base:linear: booting n0 (hn01) n-113746 ssi:boot:base:linear: booting n1 (cn01) n-113746 ssi:boot:base:linear: booting n2 (cn02) n-113746 ssi:boot:base:linear: finished However, Rmpi 0.5.5 is not: library(Rmpi) [hn01:30424] mca: base: component_find: unable to open osc pt2pt: file not found (ignored) mpi.spawn.Rslaves() 1 slaves are spawned successfully. 0 failed. master (rank 0, comm 1) of size 2 is running on: hn01 slave1 (rank 1, comm 1) of size 2 is running on: hn01 mpi.remote.exec(paste(I am,mpi.comm.rank(),of,mpi.comm.size())) $slave1 [1] I am 1 of 2 mpi.close.Rslaves() [1] 1 mpi.quit() Note how only one slave is spawned. Trials with mpiexec -n 3 R --no-save -q and the .Rprofile in place started R on multiple nodes, but produced this output: [hn01:04612] mca: base: component_find: unable to open osc pt2pt: file not found (ignored) [cn01:30306] mca: base: component_find: unable to open osc pt2pt: file not found (ignored) [cn01:30304] mca: base: component_find: unable to open osc pt2pt: file not found (ignored) [cn01:30305] mca: base: component_find: unable to open osc pt2pt: file not found (ignored) [1] [1] [1] Please use mpi.quit() to quit R Please use mpi.quit() to quit R Please use mpi.quit() to quit R - It seems that [at least] one of the processes that was started with mpirun did not invoke MPI_INIT before quitting (it is possible that more than one process did not invoke MPI_INIT -- mpirun was only notified of the first one, which was on node n0). mpirun can *only* be used with MPI programs (i.e., programs that invoke MPI_INIT and MPI_FINALIZE). You can use the lamexec program to run non-MPI programs over the lambooted nodes. - mpirun failed with exit status 252 Do you have any suggestions? Cheers, Ingeborg Schmidt __ 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] annotating a filled contours plot with a grid of points
Dear R-help members, I am trying to plot annotate a filled contours plot (with filled.contour) with a grid of points. I have read ways of annotating it with individual points but not with grids in another matrix. Any ideas? Thank you very much. Dario ___ Dario Martin-Benito CIFOR-INIA Dpto. Sistemas y Recursos Forestales Ctra. La Coruña, Km. 7.5 E-28040 Madrid (Spain ) Tel.: +34 91 347 1461 e-mail: dmar...@inia.es /// dmartinben...@gmail.com http://dmartinbenito.googlepages.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] How to convert Charagter variables into numeric
You might want to try as.numeric(X), if you want to convert a factor then you could use as.numeric(as.character(X)), where X is a variable. Karina On Thu, 5 Feb 2009 22:50:38, arup.pramani...@gmail.com wrote: I am importing a dataset in R where some of the variable are numerical and some of them are character...but the problem is that R is treating numerical variables as character (I am using is.character to judge the type). Now the question is how can I convert these character variables into numeric and also let me know about the other conversion like numeric to categorical,numeric to continuous etc.Thank you. Arup -- __ 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] annotating a filled contours plot with a grid of points
Dario, Checkout the 'plot.axes' argument to 'filled.contour'. Michael Grant --- On Fri, 2/6/09, Dario Martin-Benito dmar...@inia.es wrote: From: Dario Martin-Benito dmar...@inia.es Subject: [R] annotating a filled contours plot with a grid of points To: r-help@r-project.org Date: Friday, February 6, 2009, 8:23 AM Dear R-help members, I am trying to plot annotate a filled contours plot (with filled.contour) with a grid of points. I have read ways of annotating it with individual points but not with grids in another matrix. Any ideas? Thank you very much. Dario ___ Dario Martin-Benito CIFOR-INIA Dpto. Sistemas y Recursos Forestales Ctra. La Coruña, Km. 7.5 E-28040 Madrid (Spain ) Tel.: +34 91 347 1461 e-mail: dmar...@inia.es /// dmartinben...@gmail.com http://dmartinbenito.googlepages.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. __ 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] plm package
Hi there, additionally to the question below, how I can get data into the pdata.frame format, I have another question: Why doen't R recognize the function plm.data (), when calling it? I did load the plm library before... Greetz, Kirsten How do I actually manage to get data into the pdata.frame format? i.e. how do I declare id and time? I already tried various things and got even more error messages. for example country - c(AGO,BWA,DRC,LSO,MDG,MWI,MUS,MOZ,NAM,SYC,ZAF,SWZ,TZA,ZMB,ZWE) time1 - c(1991:2006) pdata.frame(EMPR1,id=country,time=time1) serie SYC is NA and has been removed Fehler in (function(x, i) if (is.matrix(i)) as.matrix(x)[[i]] else .subset2(x, : rekursives Indizieren auf Level 2 fehlgeschlagen where EMPR is a data.frame with 16 rows (time) and 15 columns (countries). Thank you, Kirsten -- Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a __ 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 Charagter variables into numeric
if you use read.table for the import, reading about the colClasses parameter in ?read.table may help. vQ On Thu, 5 Feb 2009 22:50:38, arup.pramani...@gmail.com wrote: I am importing a dataset in R where some of the variable are numerical and some of them are character...but the problem is that R is treating numerical variables as character (I am using is.character to judge the type). Now the question is how can I convert these character variables into numeric and also let me know about the other conversion like numeric to categorical,numeric to continuous etc.Thank you. Arup __ 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] Target Plot?
Thank you again for your response. Below is similar to what I ended up doing, i.e. example code: library(plotrix) ions-c(3.2, 5.0, 2.0) ion.names-c(Na,Ca,Mg) radial.plot(ions, labels=ion.names, rp.type=s, start=90*(3.14159/180), main=Dissolved ions in water, point.symbols=16, point.col=green, radial.lim=c(0,6), show.centroid=FALSE, cex=4) Now I will try to add on the label. Also, do you know how to make the radial rings black and a little thicker? A co-worker requested that the be made a little darker and easier to see. Thanks again. --- On Fri, 2/6/09, Jim Lemon j...@bitwrit.com.au wrote: From: Jim Lemon j...@bitwrit.com.au Subject: Re: [R] Target Plot? To: jasonkrup...@yahoo.com Date: Friday, February 6, 2009, 4:16 AM Jason Rupert wrote: I had a bit of problems with my email, so if any one responded to this I may have not received it. Is there any chance you can repost any ideas you might have? Right now I am looking at the plotrix package, but I have not been able to put together what I'm looking for. Hi Jason, I sent a brief note to check radial.plot in the plotrix package, but you may have already found this. Jim [[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] maptools: Test if point is in polygon
Renaud Lancelot renaud.lancelot at gmail.com writes: See function pip (point in polygon) in package splancs. Renaud 2009/2/5 Rainer M Krug r.m.krug at gmail.com On Thu, Feb 5, 2009 at 3:21 PM, Aleksandr Andreev aleksandr.andreev at gmail.com wrote: In R's maptools package, is there a built-in function to test if a given point is inside a given polygon on the map? The map was loaded from an ESRI Shapefile. The point's latitude and longitude are known. The initial question was not put clearly. The pip function in splancs will work for a two-column matrix of points, but not for the object in question, if it was read in from a shapefile using readShapeSpatial(). In that case, the object is a SpatialPolygonsDataFrame as defined in the sp package, and the overlay() methods in sp should be the place to look - see ?overlay-methods. Typically, one would define the query point(s) as a SpatialPoints object, and overlay it on the input object. The output is a vector of indices, showing which Polygons object the points lie in, or NA if they do not. Roger Bivand PS. These kinds of questions typically get more focussed response on the R-sig-geo list; further, RSiteSearch() with 'point polygon' does show many useful avenues. If everything else fails, convert the shape file into a raster and drill down at the location of the points. Rainer __ 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] Does the labpt object in the Polygons-class represent the centroid of the polygon
Rizzo.Michael at epamail.epa.gov writes: I need to calculate the centroids of some spatial polygons that I have placed into a Polygons-class object. Is the labeling point in the Polygons-class the centroid of the polygon? Yes. The class documentation at ?Polygons-class does not state that this is the case, because other points might be validly inserted as label points. The default constructor uses the centroid of the largest non-hole ring in the Polygons object. Roger Bivand Thank you 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] A way to lock down the order of bars for ggplot dodgedhistogram
Yes, I think it is. I'll add it to my to do list. Hadley On Fri, Feb 6, 2009 at 3:30 AM, ONKELINX, Thierry thierry.onkel...@inbo.be wrote: Hmm, I had not tested my solution. But that used to work. But I'm getting the same result as you do. So maybe this is a bug in ggplot2. Is it, Hadley? Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey Van: Jason Rupert [mailto:jasonkrup...@yahoo.com] Verzonden: donderdag 5 februari 2009 17:44 Aan: R-help@r-project.org; ONKELINX, Thierry CC: ggpl...@googlegroups.com Onderwerp: RE: [R] A way to lock down the order of bars for ggplot dodgedhistogram Thierry, Thank you for such a quick response. I changed the code, but I seem to get the same response. Ugh. Maybe I am missing a step. Thank you again for any feedback. Me_df-data.frame(Data = c(1:15), Person = Me) You_df-data.frame(Data = c(10:20), Person = You) Them_df-data.frame(Data = c(15:25), Person = Them) Group_df_tmp-rbind(Me_df,You_df) Group_df-rbind(Group_df_tmp,Them_df) Group_df$Person - factor(Group_df$Person, levels = c(Them, You, Me)) counts - ddply(Group_df, .(cut(Data, breaks=fullseq(range(Data), 5)), Person), nrow) names(counts) - c(Bin, Person, Frequency) qplot(Person, Frequency, data = counts, fill = Person, geom=bar, stat=identity, width = 0.9, xlab=Person) + facet_grid(. ~ Bin) --- On Thu, 2/5/09, ONKELINX, Thierry thierry.onkel...@inbo.be wrote: From: ONKELINX, Thierry thierry.onkel...@inbo.be Subject: RE: [R] A way to lock down the order of bars for ggplot dodgedhistogram To: jasonkrup...@yahoo.com, R-help@r-project.org Cc: ggpl...@googlegroups.com Date: Thursday, February 5, 2009, 10:17 AM Dear Jason, Convert Person to a factor with the levels in the order that you want. Group_df$Person - factor(Group_df$Person, levels = c(Them, You, Me)) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Jason Rupert Verzonden: donderdag 5 februari 2009 17:09 Aan: R-help@r-project.org CC: ggpl...@googlegroups.com Onderwerp: [R] A way to lock down the order of bars for ggplot dodgedhistogram It appears that ggplot reorder the data for a dodged histogram based on whether or not a specific variable has a value in the first bin. I would like to be able to absolutely force the order of the variables in the bin. For example, say I have three variables Me, You, and Them. Me_df-data.frame(Data = c(1:15), Person = Me) You_df-data.frame(Data = c(10:20), Person = You) Them_df-data.frame(Data = c(15:25), Person = Them) Group_df_tmp-rbind(Me_df,You_df) Group_df-rbind(Group_df_tmp,Them_df) counts - ddply(Group_df, .(cut(Data, breaks=fullseq(range(Data), 5)), Person), nrow) names(counts) - c(Bin, Person, Frequency) qplot(Person, Frequency, data = counts, fill = Person, geom=bar, stat=identity, width = 0.9, xlab=Person) + facet_grid(. ~ Bin) However, I absolutely must have the bar order be Them, You, Me. Is there a to fix the order of the bars so that they are always in the Them, You, Me order? Thank you again for any feedback you can provide. [[alternative HTML version deleted]] Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
Re: [R] How to convert Charagter variables into numeric
There is an issue that is being overlooked here. The read.table() family of functions use type.convert() by default internally to determine the resultant data types of the columns going into the data frame from the source text file. Everything read in by read.table() starts as character and then type.convert() (unless overridden by 'colClasses') does its job. If a column that should be numeric is being converted to a factor, then there is a data integrity problem in that column. In other words, there are non-numeric characters in that column, preventing the column from being converted to numeric. For example: # All 'numeric' source data str(type.convert(as.character(1:5))) int [1:5] 1 2 3 4 5 # a non-numeric character in the source vector str(type.convert(c(as.character(1:5), a))) Factor w/ 6 levels 1,2,3,4,..: 1 2 3 4 5 6 Bottom line, Arup needs to go back and review his source data to understand why the columns that should be numeric end up as factors. HTH, Marc Schwartz on 02/06/2009 07:43 AM Wacek Kusnierczyk wrote: if you use read.table for the import, reading about the colClasses parameter in ?read.table may help. vQ On Thu, 5 Feb 2009 22:50:38, arup.pramani...@gmail.com wrote: I am importing a dataset in R where some of the variable are numerical and some of them are character...but the problem is that R is treating numerical variables as character (I am using is.character to judge the type). Now the question is how can I convert these character variables into numeric and also let me know about the other conversion like numeric to categorical,numeric to continuous etc.Thank you. Arup __ 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 command system under Windows
?dir.create mkdir is a built-in for 'cmd.exe' (think of it like shell built-ins in unix, vs. an actual command in $PATH) system('cmd.exe /c mkdir foo') works, but the R command: dir.create is what you really want. On Thu, Feb 5, 2009 at 14:17, Aurelie Labbe, Dr. aurelie.la...@mcgill.ca wrote: Hi, I am trying to use the R command system under windows (XP). If I try the simple command system(mkdir toto) to create a directory toto, it tells me that it cannot find the command mkdir... Does anybody knows how it works ? Is it a path problem ? Maybe the answer is simple: I am a R user under Unix/Linux and I don't know well R under windows. Thanks ! Aurelie __ 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-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] Finding a basis in a set of vectors
Hi, Okay, I have a n x p matrix X, which I know is not full rank. In particular, there may be linear dependencies amongst the columns (but not that many). What is a fast way of finding a linearly independent subset of the columns of X that will span the column space of X, in R? If it helps, I have the QR decomposition of the original X 'for free'. I know that it's possible to do this directly by looping over the columns and adding them, but at the very least, a solution without horrible slow loops would be nice. Any ideas welcome. Zhou Fang __ 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] Tinn-R 2.2.0.1 released with a new and complete User Guide
Dears Tinn-R users, We want to announce that a new version of Tinn-R Gui/Editor (Windows OS) was released. It now has a complete User Guide, a old request of the users. The news of this version are below: 2.2.0.1 (Feb/05/2009) * Bugs fixed: 1. Latex font Enphase was fixed. It was inserting \textbf{} instead of \emph{}. 2. Save and load workspace is now enabled only if Rterm is running. 3. A bug associated with the Colors preferences interface related to Txt2tags and Deplate syntax, not allowing to change the background color of the root element in the correct way was fixed. * All prior documentation of the Tinn-R project was updated, some parts were expanded and others excluded, new ones were generated and, finally, all were joined in the new User guide. This What is new now is part of this user guide. The sources files (written in Txt2tags) of this User guide is available in the folder doc/english/user_guide where Tinn-R is installed. In this way, we hope that the user will be able to help us in making it better, day by day, by sending us any useful contribution. * The R toolbar can now be docked at left, top, right and bottom side of the main interface. Some issues related to Rterm and Tools interface when dragging the R tools bar, have not completely been solved yet. In order to fix any problem, hide and show again the Rterm or Tools interface. * The match brackets resource (default shortcut is CTRL+B) was added also to the Rterm interface (IO and Log). * The Tools interface was a bit reworked and the menu Views was changed to accommodate the changes. * The menu View and /Help was a bit reworked. * The sending and controlling R resources were extended to all instances of the synEdit class. In other words, if you put the cursor in any word, or select any text in the Editor (split or not), IO or Log (docked or not, in the same or distinct monitors) interface and, after this, select an action (print content, plot, etc) it will be executed. The installer ans sources of the project are available at SourceForge: https://sourceforge.net/project/platformdownload.php?group_id=144024sel_platform=10521 All the best, -- ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ Jose Claudio Faria Estatistica - prof. Titular UESC/DCET/Brasil joseclaudio.fa...@gmail.com joseclaudio.fa...@terra.com.br ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ __ 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] Finding a basis in a set of vectors
Zhou Fang wrote: Hi, Okay, I have a n x p matrix X, which I know is not full rank. In particular, there may be linear dependencies amongst the columns (but not that many). What is a fast way of finding a linearly independent subset of the columns of X that will span the column space of X, in R? If it helps, I have the QR decomposition of the original X 'for free'. I know that it's possible to do this directly by looping over the columns and adding them, but at the very least, a solution without horrible slow loops would be nice. Have a look at stats:::Thin.col(), but beware that it isn't terribly robust. Any ideas welcome. Zhou Fang __ 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. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ 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] glm package
Hi all, can the glm package be used to estimate a logit model to panel data? I am asking this because stata has a standard logit model and then an xtlogit for longitudinal data. Is there something similar in R? Thank you jcm [[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] Cluster analysis question
Hello All, I have data where each feature data point is a vector, and my distance measurement is a weighted dot product between vectors. I would like to use R to perform a cluster analysis on this data. Does one of the R cluster analysis routines provide for a user provided distance function? Dan Stanger Eaton Vance Management 255 State Street Boston, MA 02109 617 598 8261 [[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] how to delete specific rows in a data frame where the first column matches any string from a list
Hi, I'm new in the mailing list but I would appreciate if you could help me with this: I have a big matrix from where I need to delete specific rows. The second entry on these rows to delete should match any string within a list (other file with just one column). Thank you so much! Laura __ 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] Finding a basis in a set of vectors
Ah ha, that does work. What do you mean it isn't robust, though? I mean, obviously linear dependency structures in general are not stable under small perturbations...? Or is it that it's platform dependent? Zhou On Fri, Feb 6, 2009 at 2:28 PM, Peter Dalgaard p.dalga...@biostat.ku.dk wrote: Zhou Fang wrote: Hi, Okay, I have a n x p matrix X, which I know is not full rank. In particular, there may be linear dependencies amongst the columns (but not that many). What is a fast way of finding a linearly independent subset of the columns of X that will span the column space of X, in R? If it helps, I have the QR decomposition of the original X 'for free'. I know that it's possible to do this directly by looping over the columns and adding them, but at the very least, a solution without horrible slow loops would be nice. Have a look at stats:::Thin.col(), but beware that it isn't terribly robust. Any ideas welcome. Zhou Fang __ 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. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ 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] Problem about Mann-Kendall trend test
Dear all R-users: In my case the series is the annual number of dry spell with their length exceeding a given threshold representing extreme events frequency. 1 0 2 2 1 1 2 1 2 1 1 1 2 3 4 0 2 3 1 2 3 1 2 1 2 0 1 2 2 2 3 4 2 0 2 1 2 2 2 6 1 2 4 1 3 1 2 1 3 4 I have been using Mann-Kendall test to estimate the trend. The result gives slope of zero value but signicant p value (at 95% level).Since there are many ties in the data, I wonder Mann-Kendall is a appropriate approach to test trends. Is there other statistial method to deal with trend? Any suggestion is appreciated in advance Regards -- Wang Yi START Regional Center for Temperate East Asia(TEA), Institute of Atmospheric Physics(IAP), Chinese Academy of Sciences(CAS), Qijiahuozi Huayanli 40#, P.O.Box 9804, Beijing 100029,China Tel:13466795920 E-mail:wan...@tea.ac.cn __ 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] Fw: Problem about Mann-Kendall trend test
-- Forwarded Message --- From: Wang Yi wan...@mail.tea.ac.cn To: r-h...@stat.math.ethz.ch Sent: Fri, 6 Feb 2009 23:30:56 +0800 Subject: Problem about Mann-Kendall trend test Dear all R-users: In my case the series is the annual number of dry spell with their length exceeding a given threshold representing extreme events frequency. 1 0 2 2 1 1 2 1 2 1 1 1 2 3 4 0 2 3 1 2 3 1 2 1 2 0 1 2 2 2 3 4 2 0 2 1 2 2 2 6 1 2 4 1 3 1 2 1 3 4 I have been using Mann-Kendall test to estimate the trend. The result gives slope of zero value but signicant p value (at 95% level).Since there are many ties in the data, I wonder Mann-Kendall is a appropriate approach to test trends. Is there other statistial method to deal with trend? Any suggestion is appreciated in advance Regards -- Wang Yi START Regional Center for Temperate East Asia(TEA), Institute of Atmospheric Physics(IAP), Chinese Academy of Sciences(CAS), Qijiahuozi Huayanli 40#, P.O.Box 9804, Beijing 100029,China Tel:13466795920 E-mail:wan...@tea.ac.cn --- End of Forwarded Message --- -- Wang Yi START Regional Center for Temperate East Asia(TEA), Institute of Atmospheric Physics(IAP), Chinese Academy of Sciences(CAS), Qijiahuozi Huayanli 40#, P.O.Box 9804, Beijing 100029,China Tel:13466795920 E-mail:wan...@tea.ac.cn __ 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] Matrix Multiplication
Hi R helpers, I have two matrices A and B of the order (4 * 5) and (5 * 3) respectively. How to multiply these two matrices to obtain resultant matrix of the order (4 * 3). Thanks in advance With regards Maithili __ 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] Non-linear optimisation
Hi Ravi, To give you some background: The function compute_strategy_before_fees returns portfolio returns and standard deviation. Our optimal portfolio will maximise the returns whilst keeping the standard deviation at a certain level. We have an input matrix C that the function uses to calculate the asset weights in the portfolio over time. Problem is that I am a complete R novice and would not know where to start in optimising this in R. Could you please give some guidance on using the R functions? Thanks, Eduard -Original Message- From: Ravi Varadhan [mailto:rvarad...@jhmi.edu] Sent: 05 February 2009 19:37 To: Eduard Pieterse (Macquarie Securities) Cc: r-help@r-project.org Subject: Re: [R] Non-linear optimisation Hi, I don't understand your Matlab code. However, let me say this: - you could use L-BFGS-B algorithm in optim() or nlminb(), if you only have box constraints - you could use ConstrOptim(), if you only have linear inequality constraints - you could use Rdonlp2 if you have more general equality/inequality constraints Best, Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: ehxpieterse eduard.piete...@macquarie.com Date: Thursday, February 5, 2009 2:03 pm Subject: [R] Non-linear optimisation To: r-help@r-project.org Hi there, I have a piece of Matlab code I use to optimise a trding strategy. If there are any Matlab/R specialists out there, I would appreciate your help in doing the exact same optimisation in R. I suspect I would use nlm() in R but am not sure where to define my constraints. I have attached my Matlab code below for reference. Many thanks. Constraints function [c,ceq]=TriskellConstraints(X) global objFunc_vol; [a,b] = objFunc_vol(X); c(1) = b-6.5; c(2) = std(X(:))-6.5; ceq = []; end Optimise global objFunc_vol objFunc_vol = @(C) compute_strategy_before_fees(prices, C, floor, cap, m_ret_reb, prices_TR, hedge_fund, vg, euribor, last_reb_date, Maturity, fixed_fees, var_fees); objFunc_vol(C); objFunc = @(C) compute_strategy_before_fees(prices, C, floor, cap, m_ret_reb, prices_TR, hedge_fund, vg, euribor, last_reb_date, Maturity, fixed_fees, var_fees); objFunc(C); options = optimset('MaxIter',1000,'MaxFunEvals',1000); tic; % OPTIMISE %M = fmincon(objFunc,C,[],[],[],[],repmat(-20,12,9),repmat(20,12,9),@Triske llConstraints,options); M = fmincon(objFunc_vol,C,[],[],[],[],repmat(-20,12,9),repmat(20,12,9),@Tr iskellConstraints,options); [Z, ZZ] = compute_strategy_after_fees(prices, C, floor, cap, m_ret_reb, prices_TR, Hedge_Fund, vg, euribor, last_reb_date, Maturity, fixed_fees, var_fees, dates, variation_cap_property, eurusd); [Y, YY] = compute_strategy_after_fees(prices, M, floor, cap, m_ret_reb, prices_TR, Hedge_Fund, vg, euribor, last_reb_date, Maturity, fixed_fees, var_fees, dates, variation_cap_property, eurusd); timespent = toc/60; %converts to minutes -- View this message in context: Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. If there is any advice in this email, it is general advice only and has been prepared by Macquarie Group or one of its related entities (“Macquarie”). Macquarie has made every reasonable effort to ensure the information provided is correct, but Macquarie makes no representation nor any warranty as to whether the information is accurate, complete or up to date. To the extent permitted by law, Macquarie accepts no responsibility for any errors or misstatements, negligent or otherwise. The information provided may be based on assumptions or market conditions and may change without notice. Macquarie, its associates, officers or employees may also have interests in the financial products referred to in this information by acting in various roles. They may buy or sell the financial products as principal or agent and as such may effect transactions which are not consistent with any recommendations (if any in this information). Macquarie or its associates may also receive fees or brokerage for acting in the above capacities. The information in this email is confidential. If you ar...{{dropped:9}} __ 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] Non-linear optimisation
Hi Ravi, To give you some background: The function compute_strategy_before_fees returns portfolio returns and standard deviation. Our optimal portfolio will maximise the returns whilst keeping the standard deviation at a certain level. We have an input matrix C that the function uses to calculate the asset weights in the portfolio over time. Problem is that I am a complete R novice and would not know where to start in optimising this in R. Could you please give some guidance on using the R functions? Thanks, Eduard -- View this message in context: http://www.nabble.com/Non-linear-optimisation-tp21856818p21871853.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.
Re: [R] Cluster analysis question
Dan, Check out Fritz Leisch's flexclust package. HTH, Jim Porzak TGN.com San Francisco, CA http://www.linkedin.com/in/jimporzak use R! Group SF: http://ia.meetup.com/67/ On Fri, Feb 6, 2009 at 7:11 AM, Dan Stanger dstan...@eatonvance.com wrote: Hello All, I have data where each feature data point is a vector, and my distance measurement is a weighted dot product between vectors. I would like to use R to perform a cluster analysis on this data. Does one of the R cluster analysis routines provide for a user provided distance function? Dan Stanger Eaton Vance Management 255 State Street Boston, MA 02109 617 598 8261 [[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-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 delete specific rows in a data frame where the firstcolumn matches any string from a list
Laura: When posting to this list, it is best to provide a small example. This will facilitate better help. Here is an example of what you want to do. mat - matrix(rnorm(10), ncol=2) mat [,1] [,2] [1,] -0.1418628 -1.4559344 [2,] 0.4022863 1.4727494 [3,] 0.0158310 0.3471318 [4,] 0.3962089 -0.5179074 [5,] 1.8098082 0.7238309 ### Remove rows 2 and 3 (newMat - mat[c(-2,-3),]) [,1] [,2] [1,] -0.1418628 -1.4559344 [2,] 0.3962089 -0.5179074 [3,] 1.8098082 0.7238309 I don't know what you mean about the second part (match a string on a list). So, I didn't do anything with that -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Laura Rodriguez Murillo Sent: Friday, February 06, 2009 10:26 AM To: r-help@r-project.org Subject: [R] how to delete specific rows in a data frame where the firstcolumn matches any string from a list Hi, I'm new in the mailing list but I would appreciate if you could help me with this: I have a big matrix from where I need to delete specific rows. The second entry on these rows to delete should match any string within a list (other file with just one column). Thank you so much! Laura __ 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-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] Upgrade R program (version 2.6.2) ???
Hi All, I downloaded the R program (version 2.6.2) in last Jan 2008. I now want to upgrade the program to its latest version, but I don't want to go through the process of deleting the existing version and downloading the new version. This is because my existing R program has numerous packages that I downloaded for my research work. I want to upgrade my R program with those packages in it. Is there a way I can do this? I would appreciate if someone can help me in this issue. Thank you Regards Nidhi __ 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] Matrix Multiplication
Dear Maithili, A-matrix(1:20,4,5)B-matrix(10:24,5,3) A %*% B See ?%*% for more information. HTH, Jorge On Fri, Feb 6, 2009 at 7:57 AM, Maithili Shiva maithili_sh...@yahoo.comwrote: Hi R helpers, I have two matrices A and B of the order (4 * 5) and (5 * 3) respectively. How to multiply these two matrices to obtain resultant matrix of the order (4 * 3). Thanks in advance With regards Maithili __ 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] Upgrade R program (version 2.6.2) ???
Hi All, I downloaded the R program (version 2.6.2) in last Jan 2008. I now want to upgrade the program to its latest version, but I don't want to go through the process of deleting the existing version and downloading the new version. This is because my existing R program has numerous packages that I downloaded for my research work. I want to upgrade my R program with those packages in it. Is there a way I can do this? I would appreciate if someone can help me in this issue. Thank you Regards Nidhi __ 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] one-sample t-test with correlated (clustered) observations
I would like to estimate the difference between two measurement techniques. With both techniques, 4 measurements were obtained in each of 15 individuals. (These are not *repeated* measurements though - each of the 4 is of a different attribute). The naive approach would be a paired t-test, but of course this assumes that the 4 measures contributed by each individual are not dependent (which they are), and would inflate the CI of the differences. I found t.test.cluster {Hmisc}, but this works for the 2-sample problem only as far as I understand... Could someone please point me in the right direction? Many thanks! Paul -- View this message in context: http://www.nabble.com/one-sample-t-test-with-correlated-%28clustered%29-observations-tp21875193p21875193.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.
Re: [R] how to delete specific rows in a data frame where the first column matches any string from a list
Laura Rodriguez Murillo wrote: Hi, I'm new in the mailing list but I would appreciate if you could help me with this: I have a big matrix from where I need to delete specific rows. The second entry on these rows to delete should match any string within a list (other file with just one column). Thank you so much! here's one way to do it, illustrated with dummy data: # dummy character matrix data = matrix(replicate(20, paste(sample(letters, 20), collapse=)), ncol=2) # filter out rows where second column does not match 'a' data[-grep('a', d[,2]),] this will work also if your data is actually a data frame: data = as.data.frame(data) data[-grep('a', d[,2]),] note, due to a known issue with grep, this won't work correctly if there are *no* rows that do *not* match the pattern: data[-grep('1', d[,2]),] # should return all of data, but returns an empty matrix with the upcoming version of r, grep will have an additional argument which will make this problem easy to fix: data[grep('a', d[,2], invert=TRUE),] vQ __ 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] Matrix Multiplication
On Fri, 2009-02-06 at 04:57 -0800, Maithili Shiva wrote: Hi R helpers, I have two matrices A and B of the order (4 * 5) and (5 * 3) respectively. How to multiply these two matrices to obtain resultant matrix of the order (4 * 3). ?`%*%` E.g.: A - matrix(runif(4*5), nrow = 4) B - matrix(rnorm(5*3), nrow = 5) A %*% B [,1] [,2] [,3] [1,] 0.11087765 0.1172641 -1.965684 [2,] 0.08811864 0.6628032 -2.704704 [3,] -0.99875302 1.2822072 -1.388777 [4,] -1.01109686 1.5752980 -1.560827 Thanks in advance With regards Maithili HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% signature.asc Description: This is a digitally signed message part __ 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] non linear regression with nls
Thank you! It worked perfectly, also for the other variables! Messaggio originale Da: r...@life.ku.dk Data: 06.02.2009 13.29 A: lauramorg...@bluewin.ch Oggetto: Re: [R] non linear regression with nls Hi Laura, I think you have to make a list formulas: formList - list(NT.N ~ fz1(Portata, a, b), NT.N ~ fz2(Portata, a, b), NT.N ~ fz3(Portata, a, b, d, e), NT.N ~ fz4(Portata, a, b), NT.N ~ fz5(Portata, a, b, d)) and then in the loop: resultList[[i]] - nls(formList[[i]], ... Christian __ 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] Target Plot?
Jason Rupert jasonkrupert at yahoo.com writes: Also, do you know how to make the radial rings black and a little thicker? A co-worker requested that the be made a little darker and easier to see. library(plotrix) ions-c(3.2, 5.0, 2.0) ion.names-c(Na,Ca,Mg) radial.plot(ions, labels=ion.names, rp.type=s, start=90*(3.14159/180), main=Dissolved ions in water, point.symbols=16, point.col=green, grid.col=black, radial.lim=c(0,6), show.centroid=FALSE, cex=4) text(1,2, Sodium is hot) text(5,2, Mg bitter) __ 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 on Mobile Devices (Android)
2009/2/6 Harsh singhal...@gmail.com: Hell R-list, At the cost of sounding far-fetched and almost incredulous, I would like to know if any R user is remotely considering the use of R on Mobile devices, and Android in particular. First, rewrite R in Java. Good luck with that! http://code.google.com/android/kb/general.html#c I really do not have an idea of the kind of definite incentives in terms of using R on Android, but having an analytical engine on a mobile phone would allow for micro statistics to be collected from the log files reflecting number of calls dropped, average time spent talking, a time series of the amount of time taken for battery recharge, and a host of other information that could be collated and analyzed. R widgets could be created for analyzing the data streams from other apps running on the same device. Any thoughts/suggestions/information on this topic will be highly appreciated. I think having the analytical engine on the phone is probably not a good idea for something that is pretty much connected all the time. Better to have a lightweight data collection engine reporting back to an analytical engine on a server somewhere. Then the analytical engine generates reports on a web page. The data collection engine could do trivial summaries, statistics and graphics in Java without needing R. If you wanted to do complex time series analysis then that would be a job for the off-phone server. Barry __ 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] party package conditional variable importance
Hello, I'm trying to use the party package function varimp() to get conditional variable importance measures, as I'm aware that some of my variables are correlated. However I keep getting error messages (such as the example below). I get similar errors with three separate datasets that I'm using. At a guess it might be something to do with the very large number of variables (e.g. 23 variables, 250 or so data points) but I was wondering if anyone had any other ideas. It works fine for regular variable importance calculation. Code: biomass.cf-cforest(Total.biomass ~ ., data=biomass, control=cforest_unbiased(ntree=2500, mtry=8)) biomass.cf.vi-varimp(biomass.cf, conditional=TRUE) Error: Error in if (node[[5]][[1]] == variableID) cp - node[[5]][[3]] : argument is of length zero In addition: Warning messages: 1: In matrix(as.logical(cl), nrow = nlevels(x)) : data length [2] is not a sub-multiple or multiple of the number of rows [17] 2: In matrix(as.logical(cl), nrow = nlevels(x)) : data length [2] is not a sub-multiple or multiple of the number of rows [17] 3: In matrix(as.logical(cl), nrow = nlevels(x)) : data length [2] is not a sub-multiple or multiple of the number of rows [17] 4: In matrix(as.logical(cl), nrow = nlevels(x)) : data length [2] is not a sub-multiple or multiple of the number of rows [17] Many thanks, Meghann Mears, PhD student University of Sheffield Department of Animal Plant Sciences __ 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] maptools: Test if point is in polygon
Hi, You may want to check the package sp. There is one function called point.in.polygo that might do what you want. Good luck, Monica - Message: 32 Date: Thu, 5 Feb 2009 14:51:36 + From: baptiste auguie Subject: Re: [R] maptools: Test if point is in polygon To: Aleksandr Andreev Cc: r-help@r-project.org Message-ID: Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes I don't know about the maptools package but one general way to do this would be to compute the convex hull (?chull) of the augmented set of points and test if the point belongs to it. Hope this helps, baptiste On 5 Feb 2009, at 13:21, Aleksandr Andreev wrote: In R's maptools package, is there a built-in function to test if a given point is inside a given polygon on the map? The map was loaded from an ESRI Shapefile. The point's latitude and longitude are known. Thank you! Aleks -- Aleksandr Andreev Fulbright Fellow Graduate School of Management St Petersburg State University __ 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] Upgrade R program (version 2.6.2) ???
On Fri, 6 Feb 2009 10:41:54 -0500 (EST) Nidhi Kohli nid...@umd.edu wrote: NK has numerous packages that I downloaded for my research work. I NK want to upgrade my R program with those packages in it. Is there a NK way I can do this? I would appreciate if someone can help me in NK this issue. A bit more information would be nice... So we can only guess which operating system you are on. I would suppose you are on Windows since you seem not aware of alternatives. However on windows you could install the new R in the same directory as the old, so that the old gets overwritten. You can specify this in the installation procedure. Once you have done this you can update your packackes with update.packages(checkBuilt=TRUE) this updates the packages on your system to the current R versions packages. hth. Stefan __ 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] Upgrade R program (version 2.6.2) ???
Please don't post twice to different versions of the same address. r-help@r-project.org r-h...@stat.math.ethz.ch are the *same* list. A few posters always send to both. Despite reading this twice, we don't have the information we asked for in the posting guide. If this is Windows or Mac OS X, see the appropriate FAQ. For other platforms, this is discussed frequently in the list archives. On Fri, 6 Feb 2009, Nidhi Kohli wrote: Hi All, I downloaded the R program (version 2.6.2) in last Jan 2008. I now want to upgrade the program to its latest version, but I don't want to go through the process of deleting the existing version and downloading the new version. This is because my existing R program has numerous packages that I downloaded for my research work. I want to upgrade my R program with those packages in it. Is there a way I can do this? I would appreciate if someone can help me in this issue. Thank you Regards Nidhi __ 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. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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 Charagter variables into numeric
Dear Arup, It's very difficult to know what's going on without more information. What is the form of the data that you're importing and how are you reading the data? I ask because the most common way of getting data into R is probably via read.table(), which by default converts character data to factors but reads numbers as numeric. If a column of input data has one or more non-numeric entries (other than the default missing-data indicator NA), it will be read as a factor, even if most entries in the column are numbers. To answer your more general question, R has a number of coercion functions prefixed by as. for changing data from one form to another: For example, if by numeric to categorical you mean numeric to a factor, then as.factor() will do the trick. There is also the more general coercion function as() (see ?as). I hope this helps, John -- John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Arup Sent: February-06-09 1:51 AM To: r-help@r-project.org Subject: [R] How to convert Charagter variables into numeric I am importing a dataset in R where some of the variable are numerical and some of them are character...but the problem is that R is treating numerical variables as character (I am using is.character to judge the type). Now the question is how can I convert these character variables into numeric and also let me know about the other conversion like numeric to categorical,numeric to continuous etc.Thank you. Arup -- View this message in context: http://www.nabble.com/How-to-convert-Charagter- variables-into-numeric-tp21867485p21867485.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. __ 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 delete specific rows in a data frame where the first column matches any string from a list
Thank you. I think grep would do it, but the list of expressions I need to match is too long so they are stored in a file. So the question would be how I can tell R to look into that file to look for the expressions that I want to match. Thank you again for your help Laura 2009/2/6 Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no: Laura Rodriguez Murillo wrote: Hi, I'm new in the mailing list but I would appreciate if you could help me with this: I have a big matrix from where I need to delete specific rows. The second entry on these rows to delete should match any string within a list (other file with just one column). Thank you so much! here's one way to do it, illustrated with dummy data: # dummy character matrix data = matrix(replicate(20, paste(sample(letters, 20), collapse=)), ncol=2) # filter out rows where second column does not match 'a' data[-grep('a', d[,2]),] this will work also if your data is actually a data frame: data = as.data.frame(data) data[-grep('a', d[,2]),] note, due to a known issue with grep, this won't work correctly if there are *no* rows that do *not* match the pattern: data[-grep('1', d[,2]),] # should return all of data, but returns an empty matrix with the upcoming version of r, grep will have an additional argument which will make this problem easy to fix: data[grep('a', d[,2], invert=TRUE),] vQ __ 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] R Package to Dir structure and Folder Analysis?
I'm using R on Windows and wondering if there is an R package that allows you to do folder structure analysis. Specifically, I would like to grab the name, file size, type, and creation data of files within a folder and then to means and sigmas on the file size and creationdation date. Thank you again for your insights. [[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 command system under Windows
You could use shell indeed On Thu, Feb 5, 2009 at 6:17 PM, Aurelie Labbe, Dr. aurelie.la...@mcgill.cawrote: Hi, I am trying to use the R command system under windows (XP). If I try the simple command system(mkdir toto) to create a directory toto, it tells me that it cannot find the command mkdir... Does anybody knows how it works ? Is it a path problem ? Maybe the answer is simple: I am a R user under Unix/Linux and I don't know well R under windows. Thanks ! Aurelie __ 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. -- 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] Upgrade R program (version 2.6.2) ???
Nidhi, You neglect to say what your OS is. If you are using Windows, see the R for Windows FAQ faq 2.8. I haven't looked, but I'm sure there is a similar item for other OS. Murray M Cooper, Ph.D. Richland Statistics 9800 N 24th St Richland, MI, USA 49083 Mail: richs...@earthlink.net - Original Message - From: Nidhi Kohli nid...@umd.edu To: r-help r-help@r-project.org; r-help r-h...@stat.math.ethz.ch Sent: Friday, February 06, 2009 10:41 AM Subject: [R] Upgrade R program (version 2.6.2) ??? Hi All, I downloaded the R program (version 2.6.2) in last Jan 2008. I now want to upgrade the program to its latest version, but I don't want to go through the process of deleting the existing version and downloading the new version. This is because my existing R program has numerous packages that I downloaded for my research work. I want to upgrade my R program with those packages in it. Is there a way I can do this? I would appreciate if someone can help me in this issue. Thank you Regards Nidhi __ 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-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] beanplot, Error in shapiro.test(x)
Dear all, I am trying to create beanplots from a dataset for which boxplot works fine. (MACOS, R 2.8.1 GUI 1.27 Tiger build 32-bit (5301)) I am getting the following error message: Error in shapiro.test(x) : sample size must be between 3 and 5000 I am not even sure why the shapiro.test is being used, but is there any workaround ? Thanks ! Markus [[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] strange behavior of print vs. round
Dear friends, I have discovered what I find peculiar behavior of print. In general, print with n digits agrees with round with n digits. Although printing all the elements of a vector with digits=2 gives the expected results, printing a single element of the vector does not. x - seq(.194,.994,.1) x [1] 0.194 0.294 0.394 0.494 0.594 0.694 0.794 0.894 0.994 print(x,2) #this makes sense [1] 0.19 0.29 0.39 0.49 0.59 0.69 0.79 0.89 0.99 for(i in 1:9) print(x[i],2) #but this does not [1] 0.19 [1] 0.29 [1] 0.39 [1] 0.49 [1] 0.59 [1] 0.7 [1] 0.8 [1] 0.9 [1] 1 # But this is not a problem with round . for(i in 1:9) print(round(x[i],2)) [1] 0.19 [1] 0.29 [1] 0.39 [1] 0.49 [1] 0.59 [1] 0.69 [1] 0.79 [1] 0.89 [1] 0.99 sessionInfo() R version 2.8.1 Patched (2008-12-31 r47414) i386-apple-darwin8.11.1 locale: en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] psych_1.0-64 loaded via a namespace (and not attached): [1] tools_2.8.1 Bill -- William Revelle http://personality-project.org/revelle.html Professor http://personality-project.org/personality.html Department of Psychology http://www.wcas.northwestern.edu/psych/ Northwestern University http://www.northwestern.edu/ Use R for psychology http://personality-project.org/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.html and provide commented, minimal, self-contained, reproducible code.
[R] does R plus 3.3 need vista ?
Hi all - has anyone ot and experienced problems with R+. Have downloaded the trail and it will not work -does it need vista (like it says on the box!) Thanks glenn [[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] one-sample t-test with correlated (clustered) observations
To handle the correlations, you can treat individuals as random blocks. So you have a mixed model with measurement technique crossed with measured attribute and random intercepts for each individual. You can fit this with lmer() in the lme4 package. Keep in mind there are a number of variations on this... like whether or not to include a measurement*attribute interaction, etc. good luck, ian Paul Artes wrote: I would like to estimate the difference between two measurement techniques. With both techniques, 4 measurements were obtained in each of 15 individuals. (These are not *repeated* measurements though - each of the 4 is of a different attribute). The naive approach would be a paired t-test, but of course this assumes that the 4 measures contributed by each individual are not dependent (which they are), and would inflate the CI of the differences. I found t.test.cluster {Hmisc}, but this works for the 2-sample problem only as far as I understand... Could someone please point me in the right direction? Many thanks! Paul -- View this message in context: http://www.nabble.com/one-sample-t-test-with-correlated-%28clustered%29-observations-tp21875193p21876376.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.
Re: [R] R Package to Dir structure and Folder Analysis?
On Fri, 6 Feb 2009, Jason Rupert wrote: I'm using R on Windows and wondering if there is an R package that allows you to do folder structure analysis. ?Specifically, I would like to grab the name, file size, type,?and creation data of files within a folder and then to means and sigmas on the file size and creationdation date. ? The posting guide has lot of suggestions about how to solve a problem like this under the 'do you homework' heading. However, you don't really need to go even that far. Recent versions of R have tab completion. So take a guess as to what function might help you out, type the first few characters, then hit tab once (or maybe twice) and see what pops up. Then put a '?' in front of that function name and check the help page. Using some of the words in your 'Specifically, ...' sentence, I tried this. Some of them did not complete, some completed but were obviously not what you were after, and some were highly suggestive. Oh yes, one led to a function that seemed like an obvious winner and the example on its help page comes very close to solving your problem. Enjoy! Chuck Thank you again for your insights. ? ? [[alternative HTML version deleted]] Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ 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] RZope (UNCLASSIFIED)
Classification: UNCLASSIFIED Caveats: NONE Thank you for all the pointers to R as a Web Service. I am still reading/learning, and have come across the link http://www.analytics.washington.edu/statcomp/projects/rzope/ for Rzope, but can not get a response. Is this Project/URL no longer active? Or possibly I should I be using a different UR; and what is it now? Thank you. - Andrew M. Neiderer US Army Research Laboratory Classification: UNCLASSIFIED Caveats: NONE __ 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] does R plus 3.3 need vista ?
on 02/06/2009 11:01 AM glenn wrote: Hi all - has anyone ot and experienced problems with R+. Have downloaded the trail and it will not work -does it need vista (like it says on the box!) Thanks glenn R-Plus is a commercial version of R. You would be best served to contact the vendor (XLSolutions I believe) for details on their product. A quick Google search leads you to: http://www.experience-rplus.com/ HTH, Marc Schwartz __ 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] RZope (UNCLASSIFIED)
on 02/06/2009 10:49 AM Neiderer, Andrew (Civ, ARL/CISD) wrote: Classification: UNCLASSIFIED Caveats: NONE Thank you for all the pointers to R as a Web Service. I am still reading/learning, and have come across the link http://www.analytics.washington.edu/statcomp/projects/rzope/ for Rzope, but can not get a response. Is this Project/URL no longer active? Or possibly I should I be using a different UR; and what is it now? Thank you. You might want to contact Greg Warnes, as I believe that R-Zope was/is his project. Contact info: http://www.urmc.rochester.edu/smd/biostat/people/faculty/warnes.html HTH, Marc Schwartz __ 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 model: contrasts
The problem comes from mixing up general linear model (LM) theory to compute B with the classical anova estimators. The two methods use different approaches to solving the normal equations. LM theory uses any generalized inverse of X'X to solve the normal equations. Yours comes from ginv() which uses SVD. On the other hand, classical anova theory uses imposed contraints to give the system a unique solution. I'm not sure which generalized inverse would correspond to the one that imposes the classical anova constraints, but it must not be the one resulting from SVD in your example. Without the imposed anova constraints (called cell means), you won't have the interactions summing to zero as you want. hope that helps, Ian Stefan Kraemer-2 wrote: Hey, I am modelling a linear regression Y=X*B+E. To compute the effect of “group” the B-values of the regressors/columns that code the interaction effects (col. 5-8 and col. 11-14, see below) have to be weighted with non-zero elements within the contrast Group 1 minus Group 2 (see below). My first understanding was that the interaction effects add up to zero in each group. Why do they get non-zero contrast weights? Do you recommend any literature discussing this topic? Many Thanks, Stefan The columns of matrix X dummy-codes 1.Data of Group1 (G1) 2.Data of Group2 (G2) 3.Data condition A1 (factor A) 4.Data condition A2 (factor A) 5.Data in cell A1G1 6.Data in cell A2G1 7.Data in cell A1G2 8.Data in cell A2G2 9.Data condition B1 (factor B) 10. Data condition B2 (factor B) 11. Data in cell B1G1 12. Data in cell B2G1 13. Data in cell B1G2 14. Data in cell B2G2 15. Mean Example: #create X dimnames = list( paste(sub,c(1:8)), c(Group1,Group2,A1,A2,A1G1,A2G1, A1G2,A2G2,B1,B2, B1G1,B2G1, B1G2,B2G2,mean )) X=matrix(nrow=8,ncol=15,dimnames=dimnames) X[,1]= c(rep(1,4), rep(0,4)) X[,2]=c(rep(0,4),rep(1,4)) X[,3]=c(1,1,0,0,1,1,0,0); X[,4]=c(0,0,1,1,0,0,1,1); X[,5]=c(1,1,0,0,0,0,0,0); X[,6]=c(0,0,1,1,0,0,0,0); X[,7]=c(0,0,0,0,1,1,0,0); X[,8]=c(0,0,0,0,0,0,1,1); X[,9]=c(1, 0, 1, 0, 1, 0,1, 0); X[,10]=c(0, 1, 0, 1, 0, 1, 0, 1); X[,11]=c(1, 0, 1, 0,0, 0, 0, 0); X[,12]=c( 0, 1, 0, 1,0, 0, 0, 0); X[,13]=c( 0, 0, 0, 0, 1, 0, 1, 0) X[,14]=c(0, 0, 0, 0,0, 1, 0, 1) X[,15]=c(1,1,1,1,1,1,1,1) #y data Y=c(1.2,5.1,1.7,7,6.1,8,1.1,2.5) library(MASS) ginv() B=(ginv(t(X)%*%X) %*% t(X)) %*% Y #contrast c1=rep(0,15) c1[1]=1 c1[c(5,6,11,12)]=1/2 c2=rep(0,15) c2[2]=-1 c2[c(7,8,13,14)]=-1/2 #Group effect mean(Y[1:4])-mean(Y[5:8]) c1%*%B+c2%*%B -- -- Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a __ 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. -- View this message in context: http://www.nabble.com/Linear-model%3A-contrasts-tp21871201p21876891.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.
Re: [R] does R plus 3.3 need vista ?
You might also be interested in trying REvolution R, which is our high-performance distribution of R. There's information about REvolution R here: http://www.revolution-computing.com/products/revolution-r.php and you can download it here: http://www.revolution-computing.com/downloads/revolution-r.php It's supported on the following Windows platforms (from http://www.revolution-computing.com/forum/faq.php?faq=revr ): Windows Vista Home Premium Windows Vista Home Premium, Service Pack 1 Windows XP Professional, Service Pack 2 # David Smith -- David M Smith da...@revolution-computing.com Director of Community, REvolution Computing www.revolution-computing.com Tel: +1 (206) 577-4778 x3203 (Seattle, USA) On Fri, Feb 6, 2009 at 12:01 PM, glenn g1enn.robe...@btinternet.com wrote: Hi all - has anyone ot and experienced problems with R+. Have downloaded the trail and it will not work -does it need vista (like it says on the box!) Thanks glenn [[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-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] Using subset in validate() in Design, what is the correct syntax?
Hi I am trying to understand how to get the validate() function in Design to work with the subset option. I tried this: ovarian.cph=cph(Surv(futime, fustat) ~ age+factor(ecog.ps)+strat(rx), time.inc=1000, x=T, y=T, data=ovarian) validate(ovarian.cph) #fine when no subset is used, but the following two don't work: validate(ovarian.cph, subset=ovarian$ecog.ps==2) Error in order(c(1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, : argument lengths differ validate(ovarian.cph, subset=ovarian[ovarian$ecog.ps==2,]) Error in predab.resample(fit, method = method, fit = cox.fit, measure = discrim, : length of subset does not match # rows used in fit Any suggestions? Also, is it possible to use the subset option with calibrate as well? It would be good to be able to plot the cox fit vs. the KM fit for different age groups for example. Many many thanks! Eleni __ 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] Using subset in validate() in Design, what is the correct syntax?
Eleni Rapsomaniki wrote: Hi I am trying to understand how to get the validate() function in Design to work with the subset option. I tried this: ovarian.cph=cph(Surv(futime, fustat) ~ age+factor(ecog.ps)+strat(rx), time.inc=1000, x=T, y=T, data=ovarian) validate(ovarian.cph) #fine when no subset is used, but the following two don't work: validate(ovarian.cph, subset=ovarian$ecog.ps==2) Error in order(c(1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, : argument lengths differ validate(ovarian.cph, subset=ovarian[ovarian$ecog.ps==2,]) As stated in the documentation for predab.resample, subset should be a logical or integer vector specifying how to subset the data. Error in predab.resample(fit, method = method, fit = cox.fit, measure = discrim, : length of subset does not match # rows used in fit Any suggestions? Also, is it possible to use the subset option with calibrate as well? It Yes; predab.resample still does the work. Frank would be good to be able to plot the cox fit vs. the KM fit for different age groups for example. Many many thanks! Eleni -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ 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] Rmpi with LAM/MPI on Debian
On 6 February 2009 at 05:15, Ingeborg Schmidt wrote: | Hello, | I seem to be unable to get Lam/Mpi to work with Rmpi on Debian 5. The Debian Rmpi package (ie r-cran-rmpi) switched to Open MPI instead of LAM/MPI quite some time ago as LAM/MPI is no longer actively developed, and the LAM/MPI team itself recommends switching to Open MPI. So recent versions of r-cran-rmpi will not work with LAM/MPI. | Following the readme file, I installed the packages r-cran-rmpi and lam3 lam3-dev lam-runtime . The lam-bhost.def is configured like this: You can of course uninstall r-cran-rmpi, and then use the LAM/MPI development package (currently called liblam4 on my Debian testing system) to locally intall Rmpi into /usr/local/lib/R/site-packages via R CMD INSTALL. You will have have to follow the instruction in the Rmpi sources. | hn01 | cn01 cpu=4 | cn02 cpu=4 | | Lam seems to be fine with this: | | lamboot -v | n-113746 ssi:boot:base:linear: booting n0 (hn01) | n-113746 ssi:boot:base:linear: booting n1 (cn01) | n-113746 ssi:boot:base:linear: booting n2 (cn02) | n-113746 ssi:boot:base:linear: finished | | However, Rmpi 0.5.5 is not: | | library(Rmpi) | [hn01:30424] mca: base: component_find: unable to open osc pt2pt: file These are __Open MPI__ error messages. You are mixing systems. There is a mailing list r-sig-hpc for these question. Please consider subscribing and posting there. Hth, Dirk | not found (ignored) | mpi.spawn.Rslaves() | 1 slaves are spawned successfully. 0 failed. | master (rank 0, comm 1) of size 2 is running on: hn01 | slave1 (rank 1, comm 1) of size 2 is running on: hn01 | mpi.remote.exec(paste(I am,mpi.comm.rank(),of,mpi.comm.size())) | $slave1 | [1] I am 1 of 2 | mpi.close.Rslaves() | [1] 1 | mpi.quit() | | Note how only one slave is spawned. Trials with mpiexec -n 3 R --no-save -q and the .Rprofile in place started R on multiple nodes, but produced this output: | | [hn01:04612] mca: base: component_find: unable to open osc pt2pt: file not found (ignored) | [cn01:30306] mca: base: component_find: unable to open osc pt2pt: file not found (ignored) | [cn01:30304] mca: base: component_find: unable to open osc pt2pt: file not found (ignored) | [cn01:30305] mca: base: component_find: unable to open osc pt2pt: file not found (ignored) | | [1] | [1] | [1] Please use mpi.quit() to quit R | Please use mpi.quit() to quit R | Please use mpi.quit() to quit R | - | It seems that [at least] one of the processes that was started with | mpirun did not invoke MPI_INIT before quitting (it is possible that | more than one process did not invoke MPI_INIT -- mpirun was only | notified of the first one, which was on node n0). | | mpirun can *only* be used with MPI programs (i.e., programs that | invoke MPI_INIT and MPI_FINALIZE). You can use the lamexec program | to run non-MPI programs over the lambooted nodes. | - | mpirun failed with exit status 252 | | Do you have any suggestions? | | Cheers, | Ingeborg Schmidt | | | | | | __ | 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. -- Three out of two people have difficulties with fractions. __ 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] annotating a filled contours plot with a grid of points
Try this example: mygrid - expand.grid(x=seq(0,1, by=0.1), y=seq(0,1, by=0.1)) filled.contour(volcano, color = terrain.colors, asp = 1, plot.axes={ axis(1); axis(2); points(mygrid, cex=0.5, pch=19)}) Cheers, Marcelino From: Dario Martin-Benito dmartin at inia.es Subject: [R] annotating a filled contours plot with a grid of points To: r-help at r-project.org Date: Friday, February 6, 2009, 8:23 AM Dear R-help members, I am trying to plot annotate a filled contours plot (with filled.contour) with a grid of points. I have read ways of annotating it with individual points but not with grids in another matrix. Any ideas? Thank you very much. Dario ___ Dario Martin-Benito CIFOR-INIA Dpto. Sistemas y Recursos Forestales Ctra. La Coruña, Km. 7.5 E-28040 Madrid (Spain ) Tel.: +34 91 347 1461 e-mail: dmartin at inia.es /// dmartinbenito at gmail.com http://dmartinbenito.googlepages.comhttp://dmartinbenito.googlepages.com Marcelino de la Cruz Rot Departamento de Biología Vegetal E.U.T.I. Agrícola Universidad Politécnica de Madrid 28040-Madrid Tel.: 91 336 54 35 Fax: 91 336 56 56 marcelino.delac...@upm.es _ [[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] Finding a basis in a set of vectors
Zhou Fang wrote: Ah ha, that does work. What do you mean it isn't robust, though? I mean, obviously linear dependency structures in general are not stable under small perturbations...? Or is it that it's platform dependent? The former. In particular there is an issue with columns that have all entries near-zero. There were a couple of gotchas in its main application of thinning projection matrices within anova.mlm (the 2.8.1 version has a zapsmall() kludge for that reason). (This can of course also make things platform dependent, since roundoff accumulates differently depending on compilers and such.) Zhou On Fri, Feb 6, 2009 at 2:28 PM, Peter Dalgaard p.dalga...@biostat.ku.dk wrote: Zhou Fang wrote: Hi, Okay, I have a n x p matrix X, which I know is not full rank. In particular, there may be linear dependencies amongst the columns (but not that many). What is a fast way of finding a linearly independent subset of the columns of X that will span the column space of X, in R? If it helps, I have the QR decomposition of the original X 'for free'. I know that it's possible to do this directly by looping over the columns and adding them, but at the very least, a solution without horrible slow loops would be nice. Have a look at stats:::Thin.col(), but beware that it isn't terribly robust. Any ideas welcome. Zhou Fang __ 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. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ 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] undesired grid in ps/eps outputs generated by filled.contour or image
Hi! Whenever I save a graphic in ps/eps format generated by filled.contour or image, an undesired grid is added to it (not visible on the X11 screen). For example: postscript(volcano.eps) filled.contour(volcano,col=gray(seq(0,1,,50)),levels=seq(min(volcano),max(volcano),,50)) dev.off() Any ideia how to eliminate this grid? Thanks, Rachel [[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] Rmpi Segmentation fault
Dear all, I have used the Rmpi package many times before however this time the installation doesn't work :(. I've installed it as I always do with openMPI tar.gz file direct from the website. I'm installing on my ubuntu 8.10, R version 2.8.1. Linux 2.6.27-11-generic #1 SMP Thu Jan 29 19:28:32 UTC 2009 x86_64 GNU/Linux All i get is: library(Rmpi) Segmentation fault :~$ Which dumps me back into the shell, and doesn't give me much to work with. I've included my install of Rmpi that went fine as far as I could see. Is this a openMPI problem or Rmpi or even an R problem? Any help would be great. Also is there a way beside 'make test' to test my install of openMPI? Cheers, Paul --Rmpi install -- ~$ sudo R CMD INSTALL Rmpi_0.5-6.tar.gz * Installing to library '/usr/local/lib64/R/library' * Installing *source* package 'Rmpi' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed I am here /usr/local and it is OpenMPI Try to find mpi.h ... Found in /usr/local/include Try to find libmpi.so or libmpich.a Found libmpi in /usr/local/lib checking for openpty in -lutil... yes checking for main in -lpthread... yes configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c conversion.c -o conversion.o gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c internal.c -o internal.o gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c RegQuery.c -o RegQuery.o gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c Rmpi.c -o Rmpi.o gcc -std=gnu99 -shared -L/usr/local/lib64 -o Rmpi.so conversion.o internal.o RegQuery.o Rmpi.o -L/usr/local/lib -lmpi -lutil -lpthread -fPIC ** R ** demo ** inst ** preparing package for lazy loading ** help Building/Updating help pages for package 'Rmpi' Formats: text html latex example hosts texthtmllatex internal texthtmllatex mpi.abort texthtmllatex mpi.apply texthtmllatex example mpi.barrier texthtmllatex mpi.bcast texthtmllatex mpi.bcast.Robjtexthtmllatex mpi.bcast.cmd texthtmllatex mpi.cart.coords texthtmllatex example mpi.cart.create texthtmllatex example mpi.cart.get texthtmllatex example mpi.cart.rank texthtmllatex example mpi.cart.shifttexthtmllatex example mpi.cartdim.get texthtmllatex example mpi.comm texthtmllatex example mpi.comm.disconnect texthtmllatex mpi.comm.free texthtmllatex mpi.comm.intertexthtmllatex mpi.comm.set.errhandler texthtmllatex mpi.comm.spawntexthtmllatex mpi.const texthtmllatex mpi.dims.create texthtmllatex example mpi.exit texthtmllatex mpi.finalize texthtmllatex mpi.gathertexthtmllatex example mpi.gather.Robj texthtmllatex example mpi.get.count texthtmllatex mpi.get.processor.nametexthtmllatex mpi.get.sourcetag texthtmllatex mpi.info texthtmllatex mpi.init.sprngtexthtmllatex mpi.intercomm.merge texthtmllatex mpi.parSimtexthtmllatex mpi.parapply texthtmllatex example
[R] Suggestions on which package to use
Hi all, I have been working with the chron package thanks to some guidance from Gabor Grothendieck so I could plot activity by times. What it the best or recommended package to compare such activity between sites? I want to compare the acetify time (multiple bat species) between sites and species to see if there is any significantly difference so I can infer some habitat preference or resource availability. Tnx. __ 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] Rmpi Segmentation fault
Dear all, I have used the Rmpi package many times before however this time I've installed it as I always do with openMPI tar.gz file direct from the website. I'm installing on my ubuntu 8.10. Linux 2.6.27-11-generic #1 SMP Thu Jan 29 19:28:32 UTC 2009 x86_64 GNU/Linux All i get is: library(Rmpi) Segmentation fault :~$ Which dumps me back into the shell, and doens't give me much to work with. I've included my install of Rmpi that went fine as far as I could see. Is this a openMPI problem or Rmpi or even an R problem? Any help would be great. Also is there a way beside 'make test' to test my install of openMPI? Cheers, Paul --Rmpi install -- ~$ sudo R CMD INSTALL Rmpi_0.5-6.tar.gz * Installing to library '/usr/local/lib64/R/library' * Installing *source* package 'Rmpi' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed I am here /usr/local and it is OpenMPI Try to find mpi.h ... Found in /usr/local/include Try to find libmpi.so or libmpich.a Found libmpi in /usr/local/lib checking for openpty in -lutil... yes checking for main in -lpthread... yes configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c conversion.c -o conversion.o gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c internal.c -o internal.o gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c RegQuery.c -o RegQuery.o gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c Rmpi.c -o Rmpi.o gcc -std=gnu99 -shared -L/usr/local/lib64 -o Rmpi.so conversion.o internal.o RegQuery.o Rmpi.o -L/usr/local/lib -lmpi -lutil -lpthread -fPIC ** R ** demo ** inst ** preparing package for lazy loading ** help Building/Updating help pages for package 'Rmpi' Formats: text html latex example hosts texthtmllatex internal texthtmllatex mpi.abort texthtmllatex mpi.apply texthtmllatex example mpi.barrier texthtmllatex mpi.bcast texthtmllatex mpi.bcast.Robjtexthtmllatex mpi.bcast.cmd texthtmllatex mpi.cart.coords texthtmllatex example mpi.cart.create texthtmllatex example mpi.cart.get texthtmllatex example mpi.cart.rank texthtmllatex example mpi.cart.shifttexthtmllatex example mpi.cartdim.get texthtmllatex example mpi.comm texthtmllatex example mpi.comm.disconnect texthtmllatex mpi.comm.free texthtmllatex mpi.comm.intertexthtmllatex mpi.comm.set.errhandler texthtmllatex mpi.comm.spawntexthtmllatex mpi.const texthtmllatex mpi.dims.create texthtmllatex example mpi.exit texthtmllatex mpi.finalize texthtmllatex mpi.gathertexthtmllatex example mpi.gather.Robj texthtmllatex example mpi.get.count texthtmllatex mpi.get.processor.nametexthtmllatex mpi.get.sourcetag texthtmllatex mpi.info texthtmllatex mpi.init.sprngtexthtmllatex mpi.intercomm.merge texthtmllatex mpi.parSimtexthtmllatex mpi.parapply texthtmllatex example mpi.probe texthtml
[R] Introduction to maps (of Denmark)?
Dear R-listers, I am using R for Windows Vista 64-bit. I have no experience working with maps, but now I have to plot a map of Denmark in which each Danish county is color-coded according to its incidence rate of a particular disease. My problem is that I don't know where to start. I have read the help files to packages like 'mapplot', and their examples indicate that I am on the right track, but where do I find a suitably detailed map of Denmark, and which format should I prefer? The terminology in the help files etc. is overwhelming. Thank you in advance for any help. Best regards, Peter. *** R version 2.8.1 (2008-12-22) i386-pc-mingw32 locale: LC_COLLATE=Danish_Denmark.1252;LC_CTYPE=Danish_Denmark.1252;LC_MONETARY= Danish_Denmark.1252;LC_NUMERIC=C;LC_TIME=Danish_Denmark.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base __ 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] Joint test
Dear All, I am estimating a Cox proportional hazard model, with several interactions of the type a*z + a*y + a*x + b*z + b*y + b*x. I need to know if the first three (the as) are jointly significantly different from the last three (the bs). I have tried several approaches, but have been unsuccessful. Here's the model, and the code I came up with, with the obvious shortcomings. modelPG2 - coxph(Surv(t0, t, d) ~ civilian + monarch + txmonarch + civwar + lngdpcap + growth + tropen4 + dopen4 + lnpop + age0 + entry1 + powtimes + initiator2 + defender2 + inherit + milwinsh + millosesh + mildrawsh + milwinwar + millosewar + mildrawwar + civwinsh + civlosesh + civdrawsh + civwinwar + civlosewar + civdrawwar + monwinsh + monlosesh + mondrawsh + monwinwar + monlosewar + mondrawwar + frailty(ccode), na.action=na.exclude, data=LeaderPG.data, control=coxph.control(eps=1e-09,iter.max=100,outer.max=100)) library(aod) # To test if Military Leaders are equally sensitive to the outcome of WAR as Civilian leaders we need a JOINT test. wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(-2.9101, 2.4028, -1.6504)) #wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(0, 2.4028, 0)) wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(25:27), H0=c(-8.2330,2.3041,-0.2626)) Any help would be very much appreciated. Hein Goemans. __ 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] format \Sexpr{}
Hi everyone: It is probably something simple but I can't find anything related to this. Could someone show me how to format the sum of x. the result is 1 but I need comma formatted like this: 10,000. Since I am going to be using this number to be added to another calculation, I want to be able to remove the comma from the 10,000 value. Thanks x - c(2000,3000,5000) this is the sum of x: \Sexpr{sum(x)} Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA __ 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] RExcel waiting for OLE action
When I run a macro that uses RExcel, I get a dialog box that says Microsoft Excel is waiting for another application to complete an OLE action. There is no error in the RExcel commands in the macro, of that I am sure. The box appears to be related to the inclusion of RunRFile commands. The macro will run through the second RunRFile command, but will not execute the Worksheet.Pictures.Insert statements or the GetArray statements until the user clicks OK on the dialog box. Any insight into how I can avoid the dialog box would be appreciated. The macro is below. It's your basic, send-to-R, run R, retrieve-from-R macro. Call Rinterface.StartRServer Call Rinterface.RRun(rm(list = ls())) Call Rinterface.RRun(dev.off()) Call Rinterface.PutArray(mat1, Range(DATA_INPUT_OUTPUT!B7:I506)) Call Rinterface.PutArray(mat2, Range(DATA_INPUT_OUTPUT!J7:Q506)) Call Rinterface.PutArray(cpd, Range(DATA_INPUT_OUTPUT!A7:A506)) Call Rinterface.PutArray(name_of_assay_one, Range(DATA_INPUT_OUTPUT!B1)) Call Rinterface.PutArray(name_of_assay_two, Range(DATA_INPUT_OUTPUT!B2)) Call Rinterface.RunRFile(C:\Program Files\R\MDR Programs\AM_ACT_Macros.R) Call Rinterface.RunRFile(C:\Program Files\R\MDR Programs\AM_ACT.R) Worksheets(GRAPHS).Range(B58).Select Worksheets(GRAPHS).Range(B58).Clear Worksheets(GRAPHS).Pictures.Insert(C:\TEMP\var_means_both.jpg).Select Worksheets(GRAPHS).Range(B84).Select Worksheets(GRAPHS).Range(B84).Clear Worksheets(GRAPHS).Pictures.Insert(C:\TEMP\var_means_one.jpg).Select Worksheets(GRAPHS).Range(B110).Select Worksheets(GRAPHS).Range(B110).Clear Worksheets(GRAPHS).Pictures.Insert(C:\TEMP\var_means_two.jpg).Select Worksheets(GRAPHS).Range(B136).Select Worksheets(GRAPHS).Range(B136).Clear Worksheets(GRAPHS).Pictures.Insert(C:\TEMP\normality_one.jpg).Select Worksheets(GRAPHS).Range(B162).Select Worksheets(GRAPHS).Range(B162).Clear Worksheets(GRAPHS).Pictures.Insert(C:\TEMP\normality_two.jpg).Select Worksheets(GRAPHS).Range(B188).Select Worksheets(GRAPHS).Range(B188).Clear Worksheets(GRAPHS).Pictures.Insert(C:\TEMP\one_two.jpg).Select Worksheets(GRAPHS).Range(B214).Select Worksheets(GRAPHS).Range(B214).Clear Worksheets(GRAPHS).Pictures.Insert(C:\TEMP\pvalue_mean.jpg).Select Worksheets(GRAPHS).Range(B240).Select Worksheets(GRAPHS).Range(B240).Clear Worksheets(GRAPHS).Pictures.Insert(C:\TEMP\pvalue_hist.jpg).Select Call Rinterface.GetArray(pred_output$quant_one, Range(ASYM_MAX_ANALYSIS!A33:A37)) Call Rinterface.GetArray(pred_output$quant_two, Range(ASYM_MAX_ANALYSIS!I33:I37)) Call Rinterface.GetArray(sd_output$sd_one, Range(ASYM_MAX_ANALYSIS!B33:B37)) Call Rinterface.GetArray(sd_output$sd_two, Range(ASYM_MAX_ANALYSIS!J33:J37)) Call Rinterface.GetArray(sd_output$iqr_one, Range(ASYM_MAX_ANALYSIS!D33:D37)) Call Rinterface.GetArray(sd_output$iqr_two, Range(ASYM_MAX_ANALYSIS!L33:L37)) Call Rinterface.GetArray(pred_output$quant_one, Range(ASYM_MAX_ANALYSIS!A42:A46)) Call Rinterface.GetArray(pred_output$pred, Range(ASYM_MAX_ANALYSIS!C42:C46)) Call Rinterface.GetArray(pred_output$up_cb, Range(ASYM_MAX_ANALYSIS!I42:I46)) Call Rinterface.GetArray(pred_output$low_cb, Range(ASYM_MAX_ANALYSIS!K42:K46)) Call Rinterface.GetArray(sd_output$sd_ee[1], Range(ASYM_MAX_ANALYSIS!E50)) Call Rinterface.GetArray(pv_data$pool_sd, Range(ASYM_MAX_ANALYSIS!C55)) Call Rinterface.GetArray(pv_data$lin_sd_comb, Range(ASYM_MAX_ANALYSIS!D55)) Call Rinterface.GetArray(pv_data$const_sd_comb, Range(ASYM_MAX_ANALYSIS!I55)) Call Rinterface.GetArray(pv_data$CV_sd_comb, Range(ASYM_MAX_ANALYSIS!J55)) Call Rinterface.GetArray(pv_data$lin_sd_one, Range(ASYM_MAX_ANALYSIS!D58)) Call Rinterface.GetArray(pv_data$const_sd_one, Range(ASYM_MAX_ANALYSIS!I58)) Call Rinterface.GetArray(pv_data$CV_sd_one, Range(ASYM_MAX_ANALYSIS!J58)) Call Rinterface.GetArray(pv_data$lin_sd_two, Range(ASYM_MAX_ANALYSIS!D61)) Call Rinterface.GetArray(pv_data$const_sd_two, Range(ASYM_MAX_ANALYSIS!I61)) Call Rinterface.GetArray(pv_data$CV_sd_two, Range(ASYM_MAX_ANALYSIS!J61)) Call Rinterface.GetArray(pv_data$N_one, Range(ASYM_MAX_ANALYSIS!C64)) Call Rinterface.GetArray(pv_data$N_two, Range(ASYM_MAX_ANALYSIS!D64)) Call Rinterface.GetArray(pv_data$lin, Range(ASYM_MAX_ANALYSIS!I64)) Call Rinterface.GetArray(pv_data$FO, Range(ASYM_MAX_ANALYSIS!J64)) Call Rinterface.RRun(dev.off()) Call Rinterface.StopRServer Joe Boyer Statistical Sciences Renaissance Bldg 510, 3233-D Mail Stop RN0320 8-275-3661 cell: (610) 209-8531 [[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,
Re: [R] format \Sexpr{}
on 02/06/2009 02:32 PM Felipe Carrillo wrote: Hi everyone: It is probably something simple but I can't find anything related to this. Could someone show me how to format the sum of x. the result is 1 but I need comma formatted like this: 10,000. Since I am going to be using this number to be added to another calculation, I want to be able to remove the comma from the 10,000 value. Thanks x - c(2000,3000,5000) this is the sum of x: \Sexpr{sum(x)} See ?format and/or ?prettyNum and take note of the 'big.mark' argument: x - c(2000,3000,5000) sum(x) [1] 1 format(x, big.mark = ,) [1] 2,000 3,000 5,000 format(sum(x), big.mark = ,) [1] 10,000 Note that these will be character vectors, not numeric, so be sure to retain the original numeric value(s) for subsequent math ops. HTH, Marc Schwartz __ 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] Rmpi Segmentation fault
Dear all, I have used the Rmpi package many times before however this time I've installed it as I always do with openMPI tar.gz file direct from the website. I'm installing on my ubuntu 8.10, R version 2.8.1. Linux 2.6.27-11-generic #1 SMP Thu Jan 29 19:28:32 UTC 2009 x86_64 GNU/Linux All i get is: library(Rmpi) Segmentation fault :~$ Which dumps me back into the shell, and doens't give me much to work with. I've included my install of Rmpi that went fine as far as I could see. Is this a openMPI problem or Rmpi or even an R problem? Any help would be great. Also is there a way beside 'make test' to test my install of openMPI? Cheers, Paul --Rmpi install -- ~$ sudo R CMD INSTALL Rmpi_0.5-6.tar.gz * Installing to library '/usr/local/lib64/R/library' * Installing *source* package 'Rmpi' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed I am here /usr/local and it is OpenMPI Try to find mpi.h ... Found in /usr/local/include Try to find libmpi.so or libmpich.a Found libmpi in /usr/local/lib checking for openpty in -lutil... yes checking for main in -lpthread... yes configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c conversion.c -o conversion.o gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c internal.c -o internal.o gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c RegQuery.c -o RegQuery.o gcc -std=gnu99 -I/usr/local/lib64/R/include -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/local/include -DMPI2 -DOPENMPI -fPIC -I/usr/local/include-fpic -g -O2 -c Rmpi.c -o Rmpi.o gcc -std=gnu99 -shared -L/usr/local/lib64 -o Rmpi.so conversion.o internal.o RegQuery.o Rmpi.o -L/usr/local/lib -lmpi -lutil -lpthread -fPIC ** R ** demo ** inst ** preparing package for lazy loading ** help Building/Updating help pages for package 'Rmpi' Formats: text html latex example hosts texthtmllatex internal texthtmllatex mpi.abort texthtmllatex mpi.apply texthtmllatex example mpi.barrier texthtmllatex mpi.bcast texthtmllatex mpi.bcast.Robjtexthtmllatex mpi.bcast.cmd texthtmllatex mpi.cart.coords texthtmllatex example mpi.cart.create texthtmllatex example mpi.cart.get texthtmllatex example mpi.cart.rank texthtmllatex example mpi.cart.shifttexthtmllatex example mpi.cartdim.get texthtmllatex example mpi.comm texthtmllatex example mpi.comm.disconnect texthtmllatex mpi.comm.free texthtmllatex mpi.comm.intertexthtmllatex mpi.comm.set.errhandler texthtmllatex mpi.comm.spawntexthtmllatex mpi.const texthtmllatex mpi.dims.create texthtmllatex example mpi.exit texthtmllatex mpi.finalize texthtmllatex mpi.gathertexthtmllatex example mpi.gather.Robj texthtmllatex example mpi.get.count texthtmllatex mpi.get.processor.nametexthtmllatex mpi.get.sourcetag texthtmllatex mpi.info texthtmllatex mpi.init.sprngtexthtmllatex mpi.intercomm.merge texthtmllatex mpi.parSimtexthtmllatex mpi.parapply texthtmllatex example mpi.probe
Re: [R] undesired grid in ps/eps outputs generated by filled.contour or image
on 02/06/2009 01:32 PM Rachel Albrecht wrote: Hi! Whenever I save a graphic in ps/eps format generated by filled.contour or image, an undesired grid is added to it (not visible on the X11 screen). For example: postscript(volcano.eps) filled.contour(volcano,col=gray(seq(0,1,,50)),levels=seq(min(volcano),max(volcano),,50)) dev.off() Any ideia how to eliminate this grid? Thanks, Rachel I can confirm the problem, running: R version 2.8.1 Patched (2009-01-24 r47726) on Fedora 10. The problem is actually worse if using the pdf() device, with additional artifacts present. There was a posting about this back in 2003: https://stat.ethz.ch/pipermail/r-help/2003-August/037348.html with no replies. There is a bug report here from 2004: http://bugs.r-project.org/cgi-bin/R/Graphics?id=6763 that seems to be related. So it seems the issue has been around for a while. I tried increasing the granularity of the color scale, though without any benefit. Will have to defer to the graphics device wizaRds on this one. Marc Schwartz __ 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] Joint test
Dear All, I am estimating a Cox proportional hazard model, with several interactions of the type a*z + a*y + a*x + b*z + b*y + b*x. I need to know if the first three (the as) are jointly significantly different from the last three (the bs). I have tried several approaches, but have been unsuccessful. Here's the model, and the code I came up with, with the obvious shortcomings. modelPG2 - coxph(Surv(t0, t, d) ~ civilian + monarch + txmonarch + civwar + lngdpcap + growth + tropen4 + dopen4 + lnpop + age0 + entry1 + powtimes + initiator2 + defender2 + inherit + milwinsh + millosesh + mildrawsh + milwinwar + millosewar + mildrawwar + civwinsh + civlosesh + civdrawsh + civwinwar + civlosewar + civdrawwar + monwinsh + monlosesh + mondrawsh + monwinwar + monlosewar + mondrawwar + frailty(ccode), na.action=na.exclude, data=LeaderPG.data, control=coxph.control(eps=1e-09,iter.max=100,outer.max=100)) library(aod) # To test if Military Leaders are equally sensitive to the outcome of WAR as Civilian leaders we need a JOINT test. wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(-2.9101, 2.4028, -1.6504)) #wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(0, 2.4028, 0)) wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(25:27), H0=c(-8.2330,2.3041,-0.2626)) Any help would be very much appreciated. Hein Goemans. __ 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 delete specific rows in a data frame where the first column matches any string from a list
Laura Rodriguez Murillo wrote: Thank you. I think grep would do it, but the list of expressions I need to match is too long so they are stored in a file. what does 'too long' mean? So the question would be how I can tell R to look into that file to look for the expressions that I want to match. i guess you may still successfully use r for this, but to me it sounds like a perfect job for perl. let me know if you need more help. note, in the below, you'd use 'data[,2]' instead of 'd[,2]' (or 'd' instead of 'data'). sorry for the typo. mark, thanks for pointing this out -- the more obvious the mistake, the less visible ;) vQ Thank you again for your help Laura 2009/2/6 Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no: Laura Rodriguez Murillo wrote: Hi, I'm new in the mailing list but I would appreciate if you could help me with this: I have a big matrix from where I need to delete specific rows. The second entry on these rows to delete should match any string within a list (other file with just one column). Thank you so much! here's one way to do it, illustrated with dummy data: # dummy character matrix data = matrix(replicate(20, paste(sample(letters, 20), collapse=)), ncol=2) # filter out rows where second column does not match 'a' data[-grep('a', d[,2]),] this will work also if your data is actually a data frame: data = as.data.frame(data) data[-grep('a', d[,2]),] note, due to a known issue with grep, this won't work correctly if there are *no* rows that do *not* match the pattern: data[-grep('1', d[,2]),] # should return all of data, but returns an empty matrix with the upcoming version of r, grep will have an additional argument which will make this problem easy to fix: data[grep('a', d[,2], invert=TRUE),] vQ __ 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 delete specific rows in a data frame where the first column matches any string from a list
yep, it definitely sounds like a work for perl, but I don't know perl (unfortunately). I'm still stuck with this so I'm giving more details in case it helps: I have file A with 382 columns and 30 rows. There are rows where only the entry in first column is duplicated in other rows. In these cases, I need to delete the entire row. I also have a file B (one column and around 28 rows) with a list of the entries that are repeated. So I was trying to look for the ones that match and get rid of the entire row. Thank you! Laura 2009/2/6 Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no: Laura Rodriguez Murillo wrote: Thank you. I think grep would do it, but the list of expressions I need to match is too long so they are stored in a file. what does 'too long' mean? So the question would be how I can tell R to look into that file to look for the expressions that I want to match. i guess you may still successfully use r for this, but to me it sounds like a perfect job for perl. let me know if you need more help. note, in the below, you'd use 'data[,2]' instead of 'd[,2]' (or 'd' instead of 'data'). sorry for the typo. mark, thanks for pointing this out -- the more obvious the mistake, the less visible ;) vQ Thank you again for your help Laura 2009/2/6 Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no: Laura Rodriguez Murillo wrote: Hi, I'm new in the mailing list but I would appreciate if you could help me with this: I have a big matrix from where I need to delete specific rows. The second entry on these rows to delete should match any string within a list (other file with just one column). Thank you so much! here's one way to do it, illustrated with dummy data: # dummy character matrix data = matrix(replicate(20, paste(sample(letters, 20), collapse=)), ncol=2) # filter out rows where second column does not match 'a' data[-grep('a', d[,2]),] this will work also if your data is actually a data frame: data = as.data.frame(data) data[-grep('a', d[,2]),] note, due to a known issue with grep, this won't work correctly if there are *no* rows that do *not* match the pattern: data[-grep('1', d[,2]),] # should return all of data, but returns an empty matrix with the upcoming version of r, grep will have an additional argument which will make this problem easy to fix: data[grep('a', d[,2], invert=TRUE),] vQ __ 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] format \Sexpr{}
marc: Thanks for the quick reply. I learned something new today, I wasn't aware of the big.mark argument. --- On Fri, 2/6/09, Marc Schwartz marc_schwa...@comcast.net wrote: From: Marc Schwartz marc_schwa...@comcast.net Subject: Re: [R] format \Sexpr{} To: mazatlanmex...@yahoo.com Cc: r-h...@stat.math.ethz.ch Date: Friday, February 6, 2009, 12:39 PM on 02/06/2009 02:32 PM Felipe Carrillo wrote: Hi everyone: It is probably something simple but I can't find anything related to this. Could someone show me how to format the sum of x. the result is 1 but I need comma formatted like this: 10,000. Since I am going to be using this number to be added to another calculation, I want to be able to remove the comma from the 10,000 value. Thanks x - c(2000,3000,5000) this is the sum of x: \Sexpr{sum(x)} See ?format and/or ?prettyNum and take note of the 'big.mark' argument: x - c(2000,3000,5000) sum(x) [1] 1 format(x, big.mark = ,) [1] 2,000 3,000 5,000 format(sum(x), big.mark = ,) [1] 10,000 Note that these will be character vectors, not numeric, so be sure to retain the original numeric value(s) for subsequent math ops. HTH, Marc Schwartz __ 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] Log transformation and -Inf values for use in glm()
Hello, I am writing regarding log transformation of data in a single matrix column, and subsequent use of these data in a glm model fit. I have a data matrix in which I am using the log function to transform the values. This transformation results in -Inf values in some places, though. I then receive an error when this matrix is used in the glm function, and would like to know this can be avoided. I have attempted several methods already including the use of na.exclue commands in the glm statement: DistributionT-glm(EarlyLn$yoyras~EarlyLn$temp,family=gaussian(link = identity),na.exclude) I have also attempted to use the is.finite command: EarlyLn$yoyras-EarlyLn[is.finite(EarlyLn$yoyras)==T,] I know another option would be to use a type of find and replace command to remove entire rows of the matrix that contain 0's (before log transformation) or -Inf (after transformation), but I do not know how this is done. Thank you for any advice or tips regarding conducting this transformation and feeding the data matrix into glm. Sincerely, Paul S. __ 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 delete specific rows in a data frame where the first column matches any string from a list
I regularly deal with a similar pattern at work. People send me these big long .csv files and I have to run them through some pattern analysis to decide which rows I keep and which rows I kill off. As others have mentioned, Perl is a good candidate for this task. Another option would be a quick SQL query. It should be a snap to pull this into something like Access or OOo Base . . . . or better yet, a real database like Postgres, MySQL, etc. In case you aren't too familiar with SQL, this query could be done by deleting the rows using a self join (syntax varies by product). But, if the pattern is as simple as it sounds and / or this is a one-time job, using SQL is over-kill for the situation. I often use sed in places where Perl is over-kill, but I can't think of any way to match from row to row with sed. If anyone knows how to do this with sed, it would (probably) be easier than trying to learn how to use perl. And, I would like to know how to do this with sed too. On Fri, 2009-02-06 at 16:04 -0500, Laura Rodriguez Murillo wrote: yep, it definitely sounds like a work for perl, but I don't know perl (unfortunately). I'm still stuck with this so I'm giving more details in case it helps: I have file A with 382 columns and 30 rows. There are rows where only the entry in first column is duplicated in other rows. In these cases, I need to delete the entire row. I also have a file B (one column and around 28 rows) with a list of the entries that are repeated. So I was trying to look for the ones that match and get rid of the entire row. Thank you! Laura 2009/2/6 Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no: Laura Rodriguez Murillo wrote: Thank you. I think grep would do it, but the list of expressions I need to match is too long so they are stored in a file. what does 'too long' mean? So the question would be how I can tell R to look into that file to look for the expressions that I want to match. i guess you may still successfully use r for this, but to me it sounds like a perfect job for perl. let me know if you need more help. note, in the below, you'd use 'data[,2]' instead of 'd[,2]' (or 'd' instead of 'data'). sorry for the typo. mark, thanks for pointing this out -- the more obvious the mistake, the less visible ;) vQ Thank you again for your help Laura 2009/2/6 Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no: Laura Rodriguez Murillo wrote: Hi, I'm new in the mailing list but I would appreciate if you could help me with this: I have a big matrix from where I need to delete specific rows. The second entry on these rows to delete should match any string within a list (other file with just one column). Thank you so much! here's one way to do it, illustrated with dummy data: # dummy character matrix data = matrix(replicate(20, paste(sample(letters, 20), collapse=)), ncol=2) # filter out rows where second column does not match 'a' data[-grep('a', d[,2]),] this will work also if your data is actually a data frame: data = as.data.frame(data) data[-grep('a', d[,2]),] note, due to a known issue with grep, this won't work correctly if there are *no* rows that do *not* match the pattern: data[-grep('1', d[,2]),] # should return all of data, but returns an empty matrix with the upcoming version of r, grep will have an additional argument which will make this problem easy to fix: data[grep('a', d[,2], invert=TRUE),] vQ __ 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. -- This is the price and the promise of citizenship. -- Barack Obama, 44th President of the United States __ 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] Joint test
Dear Hein, I'm not entirely sure that I understand what you want to do, but I think that you want to test that the coefficient of milwinwar equals that of civwinwar, and similarly and simultaneously for two other pairs of coefficients. If so, you should be able to use the linear.hypothesis() function in the car package: linear.hypothesis(modelPG2, c(milwinwar = civwinwar, millosewar = civlosewar, mildrawwar = civdrawwar)) You should be able to get the same test from the wald.test() function that you tried, but I believe that you would have to build the hypothesis matrix manually. I hope this helps, John -- John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Hein Goemans Sent: February-06-09 3:30 PM To: r-h...@stat.math.ethz.ch Subject: [R] Joint test Dear All, I am estimating a Cox proportional hazard model, with several interactions of the type a*z + a*y + a*x + b*z + b*y + b*x. I need to know if the first three (the as) are jointly significantly different from the last three (the bs). I have tried several approaches, but have been unsuccessful. Here's the model, and the code I came up with, with the obvious shortcomings. modelPG2 - coxph(Surv(t0, t, d) ~ civilian + monarch + txmonarch + civwar + lngdpcap + growth + tropen4 + dopen4 + lnpop + age0 + entry1 + powtimes + initiator2 + defender2 + inherit + milwinsh + millosesh + mildrawsh + milwinwar + millosewar + mildrawwar + civwinsh + civlosesh + civdrawsh + civwinwar + civlosewar + civdrawwar + monwinsh + monlosesh + mondrawsh + monwinwar + monlosewar + mondrawwar + frailty(ccode), na.action=na.exclude, data=LeaderPG.data, control=coxph.control(eps=1e-09,iter.max=100,outer.max=100)) library(aod) # To test if Military Leaders are equally sensitive to the outcome of WAR as Civilian leaders we need a JOINT test. wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(-2.9101, 2.4028, -1.6504)) #wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(0, 2.4028, 0)) wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(25:27), H0=c(-8.2330,2.3041,-0.2626)) Any help would be very much appreciated. Hein Goemans. __ 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-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] xyplot multiple conditions and empty panels
Dear R-users, Is it possible to prevent xyplot from drawing empty panels when using multiple conditions and when the dataset has a incomplete set of condition combinations - like in the following example? I have tried to modify the drop.unused.levels argument but without any success. Any help and suggestions will be appreciated. Sebastien df - data.frame(id=c(1,1,2,2,1,1,3,3,4,4), grp=c(1,1,1,1,2,2,2,2,2,2), x=1:10, y=1:10, z=jitter(1:10)) xyplot(y+z~x|id*grp, data=df, type=c(p,l), distribute.type = T, pch=3, col=c(1,2), xlab=x axis, ylab=y axis) __ 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 delete specific rows in a data frame where the first column matches any string from a list
Hi Laura, You might want to read the manual on Data importation and exportation on the cran webpage http://cran.r-project.org/ Otherwise, have a look at ?read.table. Sebastien __ 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] Plot with x-axis dates
Hello, I am attempting to create plots using two continuous variables and it seems I should be able to use the simple plot command. However, my x-axis values are dates, and I believe this could be the reason I am receiving error messages reading: Error in Summary.factor(c(2L, 4L, 3L, 5L, 6L, 7L, 1L), na.rm = FALSE) : range not meaningful for factors I have attempted to convert the date values to official dates within R and have done that successfully using the as.date function, but this did not help in the plots. So, how can one create plots in which the x-axis is date values? I know it would be possible to convert all my dates into a different linear scale (e.g., julian dates). However, I would like to complete this process as simply as possible. Thank you for any advice or information. Sincerely, Paul S. __ 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] 16 digits and beyond? R64-bit a solution?
Hi, I am working with some extremely small p-values and I want to capture the corresponding quantiles. I see the help file it says: 'qnorm' is based on Wichura's algorithm AS 241 which provides precise results up to about 16 digits. What happen after the 16th digits? If I am running R in a server 64-bit, can that improve the chances that beyond 16th digits to still have precision? Thanks, Aldi -- __ 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] xyplot multiple conditions and empty panels
On Fri, Feb 6, 2009 at 1:15 PM, Sebastien Bihorel sebastien.biho...@cognigencorp.com wrote: Dear R-users, Is it possible to prevent xyplot from drawing empty panels when using multiple conditions and when the dataset has a incomplete set of condition combinations - like in the following example? I have tried to modify the drop.unused.levels argument but without any success. Any help and suggestions will be appreciated. Sebastien df - data.frame(id=c(1,1,2,2,1,1,3,3,4,4), grp=c(1,1,1,1,2,2,2,2,2,2), x=1:10, y=1:10, z=jitter(1:10)) xyplot(y+z~x|id*grp, data=df, type=c(p,l), distribute.type = T, pch=3, col=c(1,2), xlab=x axis, ylab=y axis) Levels are dropped for individual terms, not their combinations. If you mean to use the combination as a term, do so explicitly: xyplot(y+z~x | interaction(id, grp), df) -Deepayan __ 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] Introduction to maps (of Denmark)?
Googling for Denmark Shapefile leads to this website: http://www.vdstech.com/map_data.htm Where a few clicks lead to downloading a set of shapefiles (different levels of subdividing the country, hopefully you know more about what they correspond to than I do, about all I know about Denmark is from Hamlet, the fact that I have some ancestors from there (but I don't remember which branch), and how to make aebleskivers). These can be read into R using the maptools package as: library(maptools) dmk1 - readShapePoly('g:/downloads/DNK_adm/DNK0') dmk2 - readShapePoly('g:/downloads/DNK_adm/DNK1') dmk3 - readShapePoly('g:/downloads/DNK_adm/DNK2') simple plots can be done like: plot(dmk1) plot(dmk2) plot(dmk3) a little more complex with: plot(dmk3, col=topo.colors(248)) though of course replacing topo.colors(248) with something that is meaningful. If you need more control, then see the sp package. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Peter Jepsen Sent: Friday, February 06, 2009 1:18 PM To: r-help@r-project.org Subject: [R] Introduction to maps (of Denmark)? Dear R-listers, I am using R for Windows Vista 64-bit. I have no experience working with maps, but now I have to plot a map of Denmark in which each Danish county is color-coded according to its incidence rate of a particular disease. My problem is that I don't know where to start. I have read the help files to packages like 'mapplot', and their examples indicate that I am on the right track, but where do I find a suitably detailed map of Denmark, and which format should I prefer? The terminology in the help files etc. is overwhelming. Thank you in advance for any help. Best regards, Peter. *** R version 2.8.1 (2008-12-22) i386-pc-mingw32 locale: LC_COLLATE=Danish_Denmark.1252;LC_CTYPE=Danish_Denmark.1252;LC_MONETARY = Danish_Denmark.1252;LC_NUMERIC=C;LC_TIME=Danish_Denmark.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base __ 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-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] Joint test
Dear John, Thank you very much. Yes, I think this should do it. The basic hypothesis is to test whether the outcome of war (win, lose, draw) has a different effect on different regime types. In other words, are leaders of some regime types more sensitive to the outcome of war than others. It seems to work great for one set of models, but I get an error message in another. I will try to figure this out. Thanks very much indeed for your help. Best, Hein. --On Friday, February 06, 2009 4:41 PM -0500 John Fox j...@mcmaster.ca wrote: Dear Hein, I'm not entirely sure that I understand what you want to do, but I think that you want to test that the coefficient of milwinwar equals that of civwinwar, and similarly and simultaneously for two other pairs of coefficients. If so, you should be able to use the linear.hypothesis() function in the car package: linear.hypothesis(modelPG2, c(milwinwar = civwinwar, millosewar = civlosewar, mildrawwar = civdrawwar)) You should be able to get the same test from the wald.test() function that you tried, but I believe that you would have to build the hypothesis matrix manually. I hope this helps, John -- John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Hein Goemans Sent: February-06-09 3:30 PM To: r-h...@stat.math.ethz.ch Subject: [R] Joint test Dear All, I am estimating a Cox proportional hazard model, with several interactions of the type a*z + a*y + a*x + b*z + b*y + b*x. I need to know if the first three (the as) are jointly significantly different from the last three (the bs). I have tried several approaches, but have been unsuccessful. Here's the model, and the code I came up with, with the obvious shortcomings. modelPG2 - coxph(Surv(t0, t, d) ~ civilian + monarch + txmonarch + civwar + lngdpcap + growth + tropen4 + dopen4 + lnpop + age0 + entry1 + powtimes + initiator2 + defender2 + inherit + milwinsh + millosesh + mildrawsh + milwinwar + millosewar + mildrawwar + civwinsh + civlosesh + civdrawsh + civwinwar + civlosewar + civdrawwar + monwinsh + monlosesh + mondrawsh + monwinwar + monlosewar + mondrawwar + frailty(ccode), na.action=na.exclude, data=LeaderPG.data, control=coxph.control(eps=1e-09,iter.max=100,outer.max=100)) library(aod) # To test if Military Leaders are equally sensitive to the outcome of WAR as Civilian leaders we need a JOINT test. wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(-2.9101, 2.4028, -1.6504)) # wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(19:21), H0=c(0, 2.4028, 0)) wald.test(b=coef(modelPG2), Sigma = vcov(modelPG2), Terms= c(25:27), H0=c(-8.2330,2.3041,-0.2626)) Any help would be very much appreciated. Hein Goemans. __ 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-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] How to sort a matrix or dataframe by two columns?
Dear all, I have a matrix data and would like to sort it by col 1 first and then sort it by col 2. Can I do it in R? Thanks a lot! Bill __ 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 delete specific rows in a data frame where the first column matches any string from a list
Thank you so much! I finally got it. Laura 2009/2/6 Sebastien Bihorel sebastien.biho...@cognigencorp.com: Hi Laura, You might want to read the manual on Data importation and exportation on the cran webpage http://cran.r-project.org/ Otherwise, have a look at ?read.table. Sebastien __ 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] undesired grid in ps/eps outputs generated by filled.contour or image
On Fri, 6 Feb 2009, Marc Schwartz wrote: on 02/06/2009 01:32 PM Rachel Albrecht wrote: Hi! Whenever I save a graphic in ps/eps format generated by filled.contour or image, an undesired grid is added to it (not visible on the X11 screen). For example: postscript(volcano.eps) filled.contour(volcano,col=gray(seq(0,1,,50)),levels=seq(min(volcano),max(volcano),,50)) dev.off() Any ideia how to eliminate this grid? Thanks, Rachel I can confirm the problem, running: R version 2.8.1 Patched (2009-01-24 r47726) on Fedora 10. The problem is actually worse if using the pdf() device, with additional artifacts present. There was a posting about this back in 2003: https://stat.ethz.ch/pipermail/r-help/2003-August/037348.html with no replies. There is a bug report here from 2004: http://bugs.r-project.org/cgi-bin/R/Graphics?id=6763 that seems to be related. So it seems the issue has been around for a while. I tried increasing the granularity of the color scale, though without any benefit. Will have to defer to the graphics device wizaRds on this one. Marc Schwartz Thanks to Prof. Ripley for pointing out my error here and my apologies for leaving the impression that this was related to the R graphics devices. As it turns out, this is uniquely a PS/PDF viewer issue related to the use of anti-aliasing in the viewer. I had initially used Evince, which is the default PS/PDF viewer in GNOME (Linux desktop environment). In Evince, there does not appear to be an option to disable anti-aliasing, either within the application or in GConf, which is another application to configure GNOME application related settings. When using Adobe's Acrobat Reader for the PDF file, if I go into Edit - Preferences - Page Display and disable Smooth line art, the lines do indeed go away. There are two other anti-aliasing settings there, Smooth Text and Smooth images, which do not appear to have any effect here. I installed gsview, which is no longer part of the default Ghostscript installation for Fedora (it is now part of the new RPMFusion repo). In gsview, if I go into Media - Display Settings and change Graphics Alpha from 4 bits to 1 bit (to disable anti-aliasing), the image displays properly. The Text Alpha setting does not appear to affect this. So, to reiterate, this is a PS/PDF viewer application problem and not an R graphics device issue. If you are unable to disable anti-aliasing in the viewer that you are using, try another application. Regards, Marc __ 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 sort a matrix or dataframe by two columns?
Yes, you can: m - matrix( sample(1:5, 20, rep=TRUE), nc=2) m[ order(m[,1],m[,2]), ] Gabor On Fri, Feb 6, 2009 at 11:29 PM, Bill Hyman billhym...@yahoo.com wrote: Dear all, I have a matrix data and would like to sort it by col 1 first and then sort it by col 2. Can I do it in R? Thanks a lot! Bill __ 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. -- Gabor Csardi gabor.csa...@unil.ch UNIL DGM __ 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] Introduction to maps (of Denmark)?
Also, see this page for more ideas on mapping an auxiliary variable by county: http://r-spatial.sourceforge.net/gallery/ (e.g. plots 9, 14, 15 and 21) Kingsford Jones On Fri, Feb 6, 2009 at 3:22 PM, Greg Snow greg.s...@imail.org wrote: Googling for Denmark Shapefile leads to this website: http://www.vdstech.com/map_data.htm Where a few clicks lead to downloading a set of shapefiles (different levels of subdividing the country, hopefully you know more about what they correspond to than I do, about all I know about Denmark is from Hamlet, the fact that I have some ancestors from there (but I don't remember which branch), and how to make aebleskivers). These can be read into R using the maptools package as: library(maptools) dmk1 - readShapePoly('g:/downloads/DNK_adm/DNK0') dmk2 - readShapePoly('g:/downloads/DNK_adm/DNK1') dmk3 - readShapePoly('g:/downloads/DNK_adm/DNK2') simple plots can be done like: plot(dmk1) plot(dmk2) plot(dmk3) a little more complex with: plot(dmk3, col=topo.colors(248)) though of course replacing topo.colors(248) with something that is meaningful. If you need more control, then see the sp package. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Peter Jepsen Sent: Friday, February 06, 2009 1:18 PM To: r-help@r-project.org Subject: [R] Introduction to maps (of Denmark)? Dear R-listers, I am using R for Windows Vista 64-bit. I have no experience working with maps, but now I have to plot a map of Denmark in which each Danish county is color-coded according to its incidence rate of a particular disease. My problem is that I don't know where to start. I have read the help files to packages like 'mapplot', and their examples indicate that I am on the right track, but where do I find a suitably detailed map of Denmark, and which format should I prefer? The terminology in the help files etc. is overwhelming. Thank you in advance for any help. Best regards, Peter. *** R version 2.8.1 (2008-12-22) i386-pc-mingw32 locale: LC_COLLATE=Danish_Denmark.1252;LC_CTYPE=Danish_Denmark.1252;LC_MONETARY = Danish_Denmark.1252;LC_NUMERIC=C;LC_TIME=Danish_Denmark.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base __ 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-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-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 sort a matrix or dataframe by two columns?
Gabor, Thank you very much! Bill - Original Message From: Gábor Csárdi csa...@rmki.kfki.hu To: Bill Hyman billhym...@yahoo.com Cc: r-help@r-project.org Sent: Friday, February 6, 2009 2:37:30 PM Subject: Re: [R] How to sort a matrix or dataframe by two columns? Yes, you can: m - matrix( sample(1:5, 20, rep=TRUE), nc=2) m[ order(m[,1],m[,2]), ] Gabor On Fri, Feb 6, 2009 at 11:29 PM, Bill Hyman billhym...@yahoo.com wrote: Dear all, I have a matrix data and would like to sort it by col 1 first and then sort it by col 2. Can I do it in R? Thanks a lot! Bill __ 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. -- Gabor Csardi gabor.csa...@unil.ch UNIL DGM __ 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] Operations on difftime (abs, /, c)
Since both comparison and negation are well-defined for time differences, I wonder why abs and division are not defined for class difftime. This behavior is clearly documented on the man page: limited arithmetic is available on 'difftime' objects; but why? Both are natural, semantically sound, and useful operations and I see no obvious reason that they should give an error: sec - as.difftime(-3:3,units=secs) hour - as.difftime(-3:3,units=hours) abs( sec ) = error ... why not 3 2 1 0 1 2 3 secs? hour/sec = error ... why not 3600, 3600, ... (dimensionless numbers)? Of course, it is trivial to overload these operations for difftime-class arguments: abs.difftime - function(x) ifelse(x0,-x,x) abs(sec) [1] 3 2 1 0 1 2 3 `/.difftime` - function (e1, e2) { if (!inherits(e2, difftime)) structure(unclass(e1)/e2, units = attr(e1, units), class = difftime) else if (inherits(e1, difftime)) as.numeric(e1,attr(e2, units = units))/as.numeric(e2) else stop(second argument of / cannot be a \difftime\ object)# 1/hour remains incorrect } hour/sec [1] 3600 3600 3600 NaN 3600 3600 3600 Along the same lines, I don't understand why concatenation (c) should strip the class of difftime, but not of POSIXt/ct: class( c(sec) ) = integer class and units attribute are stripped class( c(sec,hour) ) = integer doesn't convert to common unit, giving meaningless result class( c(Sys.time()) ) = POSIXt POSIXct Again, c.difftime would be easy enough to define if it's the right thing to do. So why wouldn't it be the right thing to do? Is there some semantic or stylistic issue I'm missing here? -s [[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] Tables in legend
I need to create a legend for a simple scatter plot in the following format. This is Blah1 number1 number2 This is Blah2 number3 number4 . . . This is Blah6 number11number12 I looked up these help pages and found the following solution. lStr-c(Blah1, Blah2,Blah6, number 1, number2, ...number12) legend(x=topright,lStr,ncol=3) So this creates the tabular format I am looking for. But the width of each column is matched to the width of the longest column. So the legend now looks like this: This is Blah1 number1 number2 This is Blah2 number3 number4 . . . This is Blah6 number11number12 And thus, I have the legend occupying most part of the top half of my plot. I was wondering if there is any way to fit in the legend compactly or even better to format the width of columns 2 and 3 in the legend and remove the blank spaces between them. I have tried rounding off the number values to 3 digits with no luck. I hope this is not too ambitious to ask. Thanks in advance! Aparna __ 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.