Re: [R] POSIXct bug?
Spencer == Spencer Graves [EMAIL PROTECTED] on Sun, 27 Feb 2005 07:15:44 -0800 writes: Spencer Hi, Gabor: Of course: time zone vs. GMT. SpencerNext question: Might a simple example that Spencer illustrates this be added to the help file for Spencer as.POSIXct, and if yes, what should be done to Spencer make that happen? send such a simple example {few lines of R code + comments (# ...)} to R-devel (or to an R-core member you know who would take it up). Martin Spencer Gabor Grothendieck wrote: Spencer Graves spencer.graves at pdf.com writes: : : In R 2.0.1 under Windows 2000, at least in some cases, as.POSIXct : adds one to the date: : : March1.1959.POSIXct - as.POSIXct(1959-03-01) : March1.1959.POSIXlt - as.POSIXlt(1959-03-01) : : (Mar2.59 - as.Date(March1.1959.POSIXct)) : [1] 1959-03-02 : as.Date(March1.1959.POSIXlt) : [1] 1959-03-01 : : as.Date(as.POSIXct(Mar2.59)) : [1] 1959-03-02 : as.Date(as.POSIXct(as.character(Mar2.59))) : [1] 1959-03-03 : print(POSIX.i - as.POSIXct(1959-03-01)) : [1] 1959-03-01 Pacific Standard Time : for(i in 1:11){ : + print(date.i - as.Date(POSIX.i)) : + print(POSIX.i - as.POSIXct(as.character(date.i))) : + } : [1] 1959-03-02 : [1] 1959-03-02 Pacific Standard Time : [1] 1959-03-03 : [1] 1959-03-03 Pacific Standard Time : [1] 1959-03-04 : [1] 1959-03-04 Pacific Standard Time : [1] 1959-03-05 : [1] 1959-03-05 Pacific Standard Time : [1] 1959-03-06 : [1] 1959-03-06 Pacific Standard Time : [1] 1959-03-07 : [1] 1959-03-07 Pacific Standard Time : [1] 1959-03-08 : [1] 1959-03-08 Pacific Standard Time : [1] 1959-03-09 : [1] 1959-03-09 Pacific Standard Time : [1] 1959-03-10 : [1] 1959-03-10 Pacific Standard Time : [1] 1959-03-11 : [1] 1959-03-11 Pacific Standard Time : [1] 1959-03-12 : [1] 1959-03-12 Pacific Standard Time : : Comments? I am not sure that the code really speaks for itself. What is the bug? Note that as.Date converts dates relative to GMT, not the current time zone. If you want to convert a POSIXct date to a Date date relative to the current timezone you can convert it to character first. RNews 4/1 has a table that provides a number of such idioms. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to plot
Hello, I would like to know if R provides the similar function to produce the 4-in-1 graph (Normal Plot of Residuals, I Chart of Residuals, Histogram of Residuals Residuals vs Fits) as MiniTab. If do not have, could anyone please tell me how to produce above-mentioned individual chart? Your help is greatly appreciated. Best Regards, WeiQiang Li [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to plot
you could use directly the plot function on an `lm' object, e.g., x - runif(100, -3, 3) y - 1 + 2*x + rnorm(100) m - lm(y~x) par(mfrow=c(2,2)) plot(m) This doesn't produce the I Chart you wanted but it gives a very good picture about any strange behaviour of the residuals. I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, February 28, 2005 10:35 AM Subject: [R] How to plot Hello, I would like to know if R provides the similar function to produce the 4-in-1 graph (Normal Plot of Residuals, I Chart of Residuals, Histogram of Residuals Residuals vs Fits) as MiniTab. If do not have, could anyone please tell me how to produce above-mentioned individual chart? Your help is greatly appreciated. Best Regards, WeiQiang Li [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] averaging within columns
Hi, I'm hoping there is something like mean(dataname$wtime[name]) which will just create a column with length equal to the number of different names (levels) and an average wtime for each. So far though, I haven't had much luck figuring that one out. Does the following code do what you want? given you have the data like this: name - c(rep(jo, 4), rep(tim,3), rep(ro, 2)) wtime - c(1,2,1,3,3,2,2,1,2) mydf - data.frame(name=name, wtime=wtime) this should give you the desired result tapply(X=mydf$wtime, INDEX=list(mydf$name), FUN=mean) Hope this turns out to be useful. Best, Roland + This mail has been sent through the MPI for Demographic Rese...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to plot
On 28 Feb 2005 at 17:35, [EMAIL PROTECTED] wrote: Hello, I would like to know if R provides the similar function to produce the 4-in-1 graph (Normal Plot of Residuals, I Chart of Residuals, Histogram of Residuals Residuals vs Fits) as MiniTab. If do not have, could anyone please tell me how to produce above-mentioned individual chart? Hi x-rnorm(10) y-10*x+5+rnorm(10) plot(x,y) fit-lm(y~x) par(mfrow=c(2,2)) qqnorm(resid(fit)) hist(resid(fit)) plot(fitted(fit),resid(fit)) for three plots. You can try to construct I Chart yourself. Go through help page of lm and you can find some other options how to plot your lm result. Cheers Petr Your help is greatly appreciated. Best Regards, WeiQiang Li [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Unable to install packages
Dear Sirs , Today I've downloaded the last release of the R-Program (I an a novel user). I am interested on performing time series analysys (regression,ARIMA,ARCH) to some data-sets, therefore I would like to use some of the packages of R-Contributors (like the tseries one).When I try to install or update packages from CRAN the following text always appear: local({a - CRAN.packages() + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a, dependencies=TRUE)}) trying URL `http://cran.stat.ucla.edu/bin/windows/contrib/2.0/PACKAGES' Error in download.file(url = paste(contriburl, PACKAGES, sep = /), : cannot open URL `http://cran.stat.ucla.edu/bin/windows/contrib/2.0/PACKAGES' In addition: Warning message: unable to resolve 'cran.stat.ucla.edu'. update.packages() trying URL `http://cran.stat.ucla.edu/bin/windows/contrib/2.0/PACKAGES' Error in download.file(url = paste(contriburl, PACKAGES, sep = /), : cannot open URL `http://cran.stat.ucla.edu/bin/windows/contrib/2.0/PACKAGES' In addition: Warning message: unable to resolve 'cran.stat.ucla.edu'. I have hanged the mirror several times but I am unable to download the packages.What should I do to install them? Thanks very much.Best regards, Agustín Martín **AVISO LEGAL** Este mensaje es privado y confidencial y solamente para la persona a la que va dirigido. Si usted ha recibido este mensaje por error, no debe revelar, copiar, distribuir o usarlo en ningún sentido. Le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. No hay renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Cualquier opinión expresada en este mensaje pertenece únicamente al autor remitente, y no representa necesariamente la opinión de Santander Central Hispano, a no ser que expresamente se diga y el remitente esté autorizado para hacerlo. Los correos electrónicos no son seguros, no garantizan la confidencialidad ni la correcta recepción de los mismos, dado que pueden ser interceptados, manipulados, destruidos, llegar con demora, incompletos, o con virus. Santander Central Hispano no se hace responsable de las alteraciones que pudieran hacerse al mensaje una vez enviado.Este mensaje sólo tiene una finalidad de información, y no debe interpretarse como una oferta de venta o de compra de valores ni de instrumentos financieros relacionados. En el caso de que el destinatario de este mensaje no consintiera la utilización del correo electrónico via Internet, rogamos lo ponga en nuestro conocimiento. **DISCLAIMER*\ This mess...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Unable to install packages
MARTIN CALMARZA AGUSTIN [EMAIL PROTECTED] writes: Dear Sirs , Today I've downloaded the last release of the R-Program (I an a novel user). I am interested on performing time series analysys (regression,ARIMA,ARCH) to some data-sets, therefore I would like to use some of the packages of R-Contributors (like the tseries one).When I try to install or update packages from CRAN the following text always appear: local({a - CRAN.packages() + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a, dependencies=TRUE)}) trying URL `http://cran.stat.ucla.edu/bin/windows/contrib/2.0/PACKAGES' Error in download.file(url = paste(contriburl, PACKAGES, sep = /), : cannot open URL `http://cran.stat.ucla.edu/bin/windows/contrib/2.0/PACKAGES' In addition: Warning message: unable to resolve 'cran.stat.ucla.edu'. update.packages() trying URL `http://cran.stat.ucla.edu/bin/windows/contrib/2.0/PACKAGES' Error in download.file(url = paste(contriburl, PACKAGES, sep = /), : cannot open URL `http://cran.stat.ucla.edu/bin/windows/contrib/2.0/PACKAGES' In addition: Warning message: unable to resolve 'cran.stat.ucla.edu'. I have hanged the mirror several times but I am unable to download the packages.What should I do to install them? Thanks very much.Best regards, Agustín Martín On Windows, I presume? Did you read the Windows FAQ, Q.2.17? In all cases, you could try to download the ZIP file using your browser and then install from local ZIP file. If you cannot download that way either, well, the problem is not in R, then. Notice that you need the Windows binary (*.zip) not the *.tar.gz or *.tgz files, which contain source distributions and Macintosh files respectively (unless I guessed your system incorrectly, of course...) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problems with downloading
Maria Befring Hovda wrote: Hello I'm using your program R in a course I'm taking at the University of Oslo, and thereby I need to download it to my PC. Unfortunately I do have some problems, I do not know whish files to download and how I do it. Can you please send me a list of what to download and a like where to find it? Either ask your supervisor or look at CRAN. You can compile from sources yourself, so get the sources from CRAN, or try to get a binary corresponding to your operating system. We do not know anything about your operating system ... If my guess that you are working under Windows is correct, also Google (looking for CRAN R Windows binary) points to the same diretory that one finds when navigating through CRAN. Uwe Ligges Thanks a lot, best regards Maria Befring Hovda PhD-student Norconserv AS, Seafood Processing Research Niels Juelsgt. 50, Postbox 327, N-4002 Stavanger, Norway Phone: (+47) 51844600, Fax: (+47) 51844651, [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problems with downloading
I am assuming you are talking about a Windows machine. If so, reading http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Installation-and- Usage will point you the following windows installer http://cran.r-project.org/bin/windows/base/rw2001.exe However, you may need to ask your IT person to install it for you if you do not have administrative privileges. Regards, Adai On Mon, 2005-02-28 at 11:16 +0100, Maria Befring Hovda wrote: Hello I'm using your program R in a course I'm taking at the University of Oslo, and thereby I need to download it to my PC. Unfortunately I do have some problems, I do not know whish files to download and how I do it. Can you please send me a list of what to download and a like where to find it? Thanks a lot, best regards Maria Befring Hovda PhD-student Norconserv AS, Seafood Processing Research Niels Juelsgt. 50, Postbox 327, N-4002 Stavanger, Norway Phone: (+47) 51844600, Fax: (+47) 51844651, [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Four parameter Lognormal Dis.
Dear Sir, I want to generate a random observations from four parameter lognormal distribution. Would you please tell me how I can do that? Thanks Farinaz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problems with downloading
Adaikalavan Ramasamy wrote: I am assuming you are talking about a Windows machine. If so, reading http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Installation-and- Usage will point you the following windows installer http://cran.r-project.org/bin/windows/base/rw2001.exe However, you may need to ask your IT person to install it for you if you do not have administrative privileges. No, administrative privileges are NOT required. Uwe Ligges Regards, Adai On Mon, 2005-02-28 at 11:16 +0100, Maria Befring Hovda wrote: Hello I'm using your program R in a course I'm taking at the University of Oslo, and thereby I need to download it to my PC. Unfortunately I do have some problems, I do not know whish files to download and how I do it. Can you please send me a list of what to download and a like where to find it? Thanks a lot, best regards Maria Befring Hovda PhD-student Norconserv AS, Seafood Processing Research Niels Juelsgt. 50, Postbox 327, N-4002 Stavanger, Norway Phone: (+47) 51844600, Fax: (+47) 51844651, [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] persistance of factor levels in a data frame
Hi, Just something I don't understand: data - data.frame(V1=c(1:12),F1=c(rep(a,4),rep(b,4),rep(c,4))) data_ac - data[which(data$F1 !=b), ] levels(data_ac$F1) Why the level b is always present ? thanks Tristan, R 2.0.1 for Linux Fedora 3 -- Tristan LEFEBURE Laboratoire d'écologie des hydrosystèmes fluviaux (UMR 5023) Université Lyon I - Campus de la Doua Bat. Darwin C 69622 Villeurbanne - France Phone: (33) (0)4 26 23 44 02 Fax: (33) (0)4 72 43 15 23 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] persistance of factor levels in a data frame
look at ?[.data.frame and also check this: dat - data.frame(V1=c(1:12), F1=rep(letters[1:3], each=4)) dat.ac - dat[dat$F1 !=b, ] ### dat.ac$F1 dat.ac$F1[, drop=TRUE] ### dat.ac$F1 - dat.ac$F1[, drop=TRUE] levels(dat.ac$F1) I hope it helps. best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Lefebure Tristan [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, February 28, 2005 2:07 PM Subject: [R] persistance of factor levels in a data frame Hi, Just something I don't understand: data - data.frame(V1=c(1:12),F1=c(rep(a,4),rep(b,4),rep(c,4))) data_ac - data[which(data$F1 !=b), ] levels(data_ac$F1) Why the level b is always present ? thanks Tristan, R 2.0.1 for Linux Fedora 3 -- Tristan LEFEBURE Laboratoire d'écologie des hydrosystèmes fluviaux (UMR 5023) Université Lyon I - Campus de la Doua Bat. Darwin C 69622 Villeurbanne - France Phone: (33) (0)4 26 23 44 02 Fax: (33) (0)4 72 43 15 23 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] persistance of factor levels in a data frame
Lefebure Tristan [EMAIL PROTECTED] writes: Hi, Just something I don't understand: data - data.frame(V1=c(1:12),F1=c(rep(a,4),rep(b,4),rep(c,4))) data_ac - data[which(data$F1 !=b), ] levels(data_ac$F1) Why the level b is always present ? Because it is a property of the definition, not of the data. E.g. if you tabulate it, you generally want to get a zero entry if there are no bs in the data. If, for some reason, you want to reduce the factor to only those levels that are present, factor() gets you there soon enough: levels(factor(data_ac$F1)) [1] a c -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] persistance of factor levels in a data frame
Lefebure Tristan wrote: Hi, Just something I don't understand: data - data.frame(V1=c(1:12),F1=c(rep(a,4),rep(b,4),rep(c,4))) data_ac - data[which(data$F1 !=b), ] levels(data_ac$F1) Why the level b is always present ? thanks Tristan, R 2.0.1 for Linux Fedora 3 You must explicitly drop unused levels of a factor created by subsetting. levels(data_ac$F1[drop = TRUE]) [1] a c __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] 3d scatterplots of more than 1 data set
Dear Saurav, The scatter3d() function in the Rcmdr package will plot by groups, using different colours for the groups. The function can be used directly or called via the Rcmdr menus. scatter3d() appears to do what you want, but in any event is a straightforward function, and you should be able to alter it, or simply add to the plot using, e.g., rgl.spheres() from the rgl package. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Saurav Pathak Sent: Sunday, February 27, 2005 11:33 PM To: r-help@stat.math.ethz.ch Subject: [R] 3d scatterplots of more than 1 data set hi, i am need to plot two or more sets of data in a 3d scatterplot, each set with different color. i tried Rcmdr, and the 3d scatterplot facility, based on rgl. that is what i need. but i cannot seem to code different sets of data differently. any help will be very helpful. i tried scatterplot3d, but it is difficult to get the right angle in it. i need to be able to rotate the axes, and export an eps file from the right angle. thanks in advance. -- saurav __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] persistance of factor levels in a data frame
On 28 Feb 2005 at 14:07, Lefebure Tristan wrote: Hi, Just something I don't understand: data - data.frame(V1=c(1:12),F1=c(rep(a,4),rep(b,4),rep(c,4))) data_ac - data[which(data$F1 !=b), ] levels(data_ac$F1) Why the level b is always present ? H Tristan from ?[.factor Extract or Replace Parts of a Factor Description: Extract or replace subsets of factors. Usage: x[i, drop = FALSE] x[i] - value Arguments: x: a factor i: a specification of indices - see 'Extract'. drop: logical. If true, unused levels are dropped. *** default is FALSE so unused levels are retained. factor(data_ac$F1) gives you the same factor with only existing levels. Cheers Petr thanks Tristan, R 2.0.1 for Linux Fedora 3 -- Tristan LEFEBURE Laboratoire d'cologie des hydrosystmes fluviaux (UMR 5023) Universit Lyon I - Campus de la Doua Bat. Darwin C 69622 Villeurbanne - France Phone: (33) (0)4 26 23 44 02 Fax: (33) (0)4 72 43 15 23 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] persistance of factor levels in a data frame
On Mon, 2005-02-28 at 14:07 +0100, Lefebure Tristan wrote: Hi, Just something I don't understand: data - data.frame(V1=c(1:12),F1=c(rep(a,4),rep(b,4),rep(c,4))) data_ac - data[which(data$F1 !=b), ] levels(data_ac$F1) Why the level b is always present ? thanks Tristan, R 2.0.1 for Linux Fedora 3 See ?[.factor for details. You will note that the argument 'drop' is FALSE by default, which means that unused levels of a factor are not dropped when subsetting. This can be important if you might want to join or compare factors from more than one source, where you want to ensure that the factor levels are the same. If you were to drop the unused levels in one factor, but it is present in the other, the comparison would be problematic, since the levels for the same values in the two factors would be different. If you want to force the unused levels to be dropped before using a factor, just use: data_ac$F1 - factor(data_ac$F1) data_ac$F1 [1] a a a a c c c c Levels: a c See ?factor for more information. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] [R-pkgs] New package: ROCR (Visualizing classifier performance)
Dear R users, we are glad to announce the release of our new R package ROCR, for visualizing the performance of scoring classifiers (available on CRAN). We hope that the package might be useful for those of you working on classification problems. For details, see the package description below, or the ROCR website: http://rocr.bioinf.mpi-sb.mpg.de. You can get a short overview by typing 'demo(ROCR)'. Any kind of feedback (questions, comments, suggestions, bug reports) is very welcome. Best regards, the ROCRs (Tobias Sing, Oliver Sander, Niko Beerenwinkel, Thomas Lengauer) Package description: - ROC graphs, sensitivity/specificity curves, lift charts, and precision/recall plots are popular examples of trade-off visualizations for specific pairs of performance measures. ROCR is a flexible tool for creating cutoff-parametrized 2D performance curves by freely combining two from over 25 performance measures (new performance measures can be added using a standard interface). Curves from different cross-validation or bootstrapping runs can be averaged by different methods, and standard deviations, standard errors or box plots can be used to visualize the variability across the runs. The parametrization can be visualized by printing cutoff values at the corresponding curve positions, or by coloring the curve according to cutoff. All components of a performance plot can be quickly adjusted using a flexible parameter dispatching mechanism. Despite its flexibility, ROCR is easy to use, with only three commands and reasonable default values for all optional parameters. __ Tobias Sing phone: +49 681 9325 315 Max-Planck-Institut für Informatik fax : +49 681 9325 399 Stuhlsatzenhausweg 85 email:[EMAIL PROTECTED] 66123 Saarbrücken, Germany web : http://www.tobiassing.net ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Legal issues
Hi R Users: I have some legal questions about R development. R is under GNU Licence, version 2. How the core team deal with their employer (most of the cases it Universities, I don't know if public or private) about their contribution to R development? Do you have to make all the work outside the institution? Is it part of the work at the institution, the R development? Do the institution give resources to the team, for example, the computer server where R is allocated? Thank you very much for your help! -- Kenneth Roy Cabrera Torres Universidad Nacional de Colombia Sede Medelln Cel 315 504 9339 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] prediction, gam, mgcv
My model is of the form: mod-gam(y~s(x0)+s(x1)+s(x2),family=poisson). But I want to get estimate and standard error of the difference of two fitted values. The following code shows you how to do this (a) for differences on the scale of the linear predictor, and (b) for differences on the scale of the response. (Could be made more efficient at the cost of being a bit less readable) best, Simon ## simulating data n - 300 x - runif(n) f - 0.2*x^11*(10*(1-x))^6+10*(10*x)^3*(1-x)^10 f - exp(f/5) y - rpois(f,f) ## fit gam mod - gam(y~s(x),family=poisson) ## creat prediction data frame pd - data.frame(x=c(.5,.6)) ## create matrix, Xp, mapping parameters to linear predictor Xp - predict(mod,pd,type=lpmatrix) ### First working on scale of linear predictor, repeatedly using ### fact that if X=CY where C is a matrix of coefficients and ### X and Y are random vectors, then cov(X) = C cov(Y) C' ## extract model coefficients and their covariance matrix b - coef(mod) Vb - mod$Vp ## obtain predictions and their covariance matrix pred - Xp%*%b Vpred - Xp%*%Vb%*%t(Xp) ## find difference and associated standard deviation diff - c(1,-1) diff.pred - t(diff)%*%pred diff.sd - sqrt(t(diff)%*%Vpred%*%diff) diff.pred;diff.sd ### Now working on response scale, by simulation library(MASS) ## simulate 1000 rep. param. vectors from posterior distn... br - mvrnorm(n=1000,b,Vb) diff.pred - rep(0,1000) for (i in 1:1000) { ## for each rep pred - Xp%*%br[i,] ## get l.p. predictions ## and hence calculate the required response scale difference diff.pred[i] - exp(pred[1])-exp(pred[2]) } ## diff.pred now contains 1000 rep. differences, so can easily estimated ## their standard deviation sd(diff.pred) ## and here is the point estimate ... pred - Xp%*%b exp(pred[1])-exp(pred[2]) _ Simon Wood [EMAIL PROTECTED]www.stats.gla.ac.uk/~simon/ Department of Statistics, University of Glasgow, Glasgow, G12 8QQ Direct telephone: (0)141 330 4530 Fax: (0)141 330 4814 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] A problem about outer()
Dear all, I have something about function outer() that I can't understand. Just see the following example. The two NaNs are due to 0/0, but I can't figure out the cause of the last two errors. I wonder if some one can explain this for me. ___ sx=rbinom(10,1,0.5);ot=rbinom(10,1,0.5);ag - rbinom(10,100,0.3);ho - rbinom(10,100,0.5) dp - function(s,a,h)sum((sx==s)(ag==a)(ho==h)(ot==1))/sum((sx==s)(ag==a)(ho==h)) (function(x,y)dp(1,x,y))(2,3) [1] NaN (function(x,y)dp(0,x,y))(27,52) [1] NaN dpm - outer(ag,ho,function(x,y)dp(1,x,y)) Error in outer(ag, ho, function(x, y) dp(1, x, y)) : dim- : dims [product 100] do not match the length of object [1] dpf - outer(ag,ho,function(x,y)dp(0,x,y)) Error in outer(ag, ho, function(x, y) dp(0, x, y)) : dim- : dims [product 100] do not match the length of object [1] --- Thanks very much, Feng [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Ask for your help
Dear Sir(or madam), I got following error information when I run the haplo.glm program.Could you tell me which wrong was happened in my program?Many thanks. Shanchun fit.gaus - haplo.glm(y ~ SEX+geno, family = gaussian, + data=my.data, locus.label=label, control = + haplo.glm.control(haplo.freq.min = 0.02)) Error in haplo.model.frame(m, locus.label = locus.label, allele.lev = allele.lev, : Missing allele.lev = list of vectors for labels of alleles Check par list for haplo.glm -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A problem about outer()
You might want to read (or re-read) the posting guide about giving a simple example. See comments below. On Mon, 2005-02-28 at 23:03 +0800, Feng Chen wrote: Dear all, I have something about function outer() that I can't understand. Just see the following example. The two NaNs are due to 0/0, but I can't figure out the cause of the last two errors. I wonder if some one can explain this for me. ___ sx=rbinom(10,1,0.5);ot=rbinom(10,1,0.5);ag - rbinom(10,100,0.3);ho - rbinom(10,100,0.5) Cute but unfortunately not very legible. Why are you mixing = and - ? Is there a problem with space bars and return key on your keyboard ? Please learn to wrap the emails at about 72 characters per line (see http://expita.com/nomime.html). dp - function(s,a,h)sum((sx==s)(ag==a)(ho==h)(ot==1))/sum((sx==s)(ag==a)(ho==h)) (function(x,y)dp(1,x,y))(2,3) [1] NaN (function(x,y)dp(0,x,y))(27,52) [1] NaN Again this is confusing. Why not define another function (you will need to anyway - see below). Alternatively, you can set 1 as the default value for s in dp(). dpm - outer(ag,ho,function(x,y)dp(1,x,y)) Error in outer(ag, ho, function(x, y) dp(1, x, y)) : dim- : dims [product 100] do not match the length of object [1] From help(outer) : 'FUN' must be a function (or the name of it) which expects at least two arguments and which operates elementwise on arrays. And following the suggestion of Prof. Daalgard in the thread http://tolstoy.newcastle.edu.au/R/help/00a/1445.html dp.vect - function(s, x, y){ sapply( 1:length(x), function(i) dp( s=s, a=x[i], h=y[i]) ) } outer(ag, ho, FUN=dp.vect, s=1 ) # works but I leave the verification to you Your problem could be generalised as the following example one - rnorm(3); two - rnorm(4) # data outer( one, two, function(x, y) x + y ) # works fine outer( one, two, function(x, y) sum(c(x, y)) ) # does not work sum.vect - function(x, y){ sapply( 1:length(x), function(i) sum( c( x[i], y[i] ) ) ) } outer( one, two, sum.vect ) dpf - outer(ag,ho,function(x,y)dp(0,x,y)) Error in outer(ag, ho, function(x, y) dp(0, x, y)) : dim- : dims [product 100] do not match the length of object [1] --- Thanks very much, Feng [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] [R-pkgs] phpSerialize 0.8
New on CRAN: phpSerialize Version 0.8 Dieter Menne, [EMAIL PROTECTED] Serializes R objects for PHP import into an associative array. Main use is for building web pages with R-support. Has mainly been tested with lm,lme, nlme and their summaries. A web example is provide, showing -- How to start R from php/Apache -- How to pass variables from php to R via Environment -- How to create serialized php output from R -- How to read the serialize output from php/Apache via pipe -- How to display individual results in a table -- How to display the structure of the associative array. For example, the following R structure... Delta=as.numeric(Sys.getenv(DELTA)) # Get Info from php wc = wilcox.test(rnorm(10),rnorm(10)+Delta) ... is is piped to standard output cat(phpSerialize(wc),\n) ... and after deserialization $pp = popen($Rterm --no-save --slave 21 $RFile DELTA=$Delta,r); // Read serialized R output via pipe. $sWilcox=fgets($pp); pclose($pp); $Wilcox=unserialize($sWilcox); print_r($Wilcox); ... prints as follows: Array ( [statistic] = Array ( [W] = 29 ) [parameter] = [p.value] = 0.1230055 [null.value] = Array ( [mu] = 0 ) [alternative] = two.sided [method] = Wilcoxon rank sum test [data.name] = rnorm(10) and rnorm(10) + Delta ) ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Using mutiply imputed data in NLME
Dear All, I am doing a growth modeling using NLME. I have three levels in my data: observation, individual, household. About half of my total sample have missing values in my household-level covariates. Under this situation, the best way to go is probably to multiply impute the data (for, say, 5 times), estimate the same model separately on each model using LME function, and merge the results. My question is: given the multiply imputed data sets have already been generated, is there a simple way to automate the process of estimating the mixed model and merging the results? HLM has similar features... Thanks! Best, Shige __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] tkRplot under macos x
It only works under X11; if that is what you want this posting should tell you what needs to be done: https://stat.ethz.ch/pipermail/r-sig-mac/2004-December/001465.html Best, luke On Mon, 28 Feb 2005, Sean Davis wrote: I have not successfully gotten tkRplot to install on macos 10.3.8, R 2.0.0. Other tcltk packages work just fine. Any suggestions? I can post all the output from the compile,etc., but thought I would check the short version first. Thanks, Sean [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Luke Tierney University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] and [ESS] Starting ESS
Hi, Yes, I defined the HOME environment variable as instructed in the installation instructions. Also, I can happily switch buffers in Emacs (C-x C-b or using C-x C-o) to the R-window and back to the .r file I am editing without any problem... If it matters, I am using Windows XP on a Dell Inspiron 9100 laptop, and the latest version of R. Thanks, Suresh On Mon, 28 Feb 2005, Vincent Goulet wrote: Suresh, Did you define a HOME environment variable for Emacs to use (as instructed in the installation instructions)? I observed that when the HOME variable is not defined (or points to a non-existent directory), Emacs will freeze as soon as one toggles from the Emacs window to another application and back to Emacs. And of course, I should have written FSF Emacs in my original post, not FSG. Hope this helps! Le 26 Février 2005 00:06, Suresh Krishna a écrit : Prof. Goulet, I apologize in advance if I shouldnt have been writing to you directly; but I thought that my problem was simple enough that you could very quickly say if you knew of a quick fix for this. Because I am familiar with the Emacs editor, I was happily and gratefully using your packaged version of FSG Emacs after you suggested it here on the list (R-help); but I have run into a problem that occurs when i run: x=1; y=1; par(ask=T) plot(x,y) emacs/ess/r now freezes because it is waiting for me to hit enter to see the next plot, however, when i hit enter, i am not sure R is able to realize that i hit enter. also, the hit enter to see next plot message is not displayed in the window with the r process. If this is a problem that is somehow specific to what I am doing, then please let me know. I have switched back to JGR and the mouse, until then. Thanks !! Suresh Vincent Goulet wrote: To answer your question: I don't think it matters. If you're willing to use FSG Emacs instead of XEmacs, I repackaged Emacs 21.3 for Windows together with recent versions of ESS and AuCTeX for my students (I personally run Linux). The package and installation instructions are at: http://vgoulet.act.ulaval.ca/download/software/emacs/ (Look for files emacs-21.3-ready.zip, emacs_install_en.txt and perhaps ess_s-plus_win_en.txt.) Hope this helps! Le 23 Février 2005 18:16, Laura Holt a écrit : Dear R People: I have finally seen the error of my ways and have decided to use ESS for R and S + stuff. However, I have a question right from the beginning. I'm somewhat confused by the installation instructions. Do I install XEMACS or ESS first, please? Windows XP R Version 2.0.1 (S + 6.2) Thanks so much! Sincerely, Laura Holt mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Vincent Goulet, Associate Professor École d'actuariat Université Laval, Québec [EMAIL PROTECTED] http://vgoulet.act.ulaval.ca __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] memory problem with mac os X
Dear list, I am using R.2.0.1 on a G5 biprocessor 2.5GHz with 2Go RAM (Mac OS X 10.3.8). I'm trying to calculate an object of type dist. I am getting the following memory error : *** malloc: vm_allocate(size=1295929344) failed (error code=3) *** malloc[25960]: error: Can't allocate region Error: cannot allocate vector of size 1265554 Kb When I do a top on the terminal, I can see that this size has already been allocated... It seems that R tries to allocate the memory twice. Does anybody have an advice about this ? Thanks, Edouard Henrion __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] draw random samples from empirical distribution
Dear useRs, I have an empirical distribution (not normal etc) and I want to draw random samples from it. One solution I can think of is to compute let's say 100 quantiles, then use runif() to draw a random number Q between 1 and 100, and finally run runif() again to pull a random value from the quantile Q. Is there perhaps a better/more elegant way of doing this? Thank you, b. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] formatting output
Dear R-users A basic question that I wasn't able to solve: Is it possible to get the results of the function 'quantile' expressed as data.frame? What I'm doing is to apply the following code to get the quantiles in a particular dataset: tmp-tapply(data$DEN,list(Age=data$AGE,Sex=data$SEX),quantile) and then I save this output to HTML using the library R2HTML. However in order to format the tables in HTML I have to use the command HTML.data.frame(...) which allows me to define, for example, the number of digits in the html table. But the object 'tmp' is not a dataframe and I can't coarce it to this format. Is it possible to get the results of this function as a dataframe? I know that I'm probably missing some important concepts here but Im not very good in programming. Any hint will be appreciated Regards Peyuco __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R Reference Card (especially useful for Newbies)
Newbies (and others!) may find the R Reference Card made available by Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf or on the Contributed link on CRAN (where some other reference cards are also linked) useful. It categorizes and organizes a bunch of R's (S's) basic, most used functions so that they can be easily found. For example, paste() is under the Strings heading and expand.grid() is under Data Creation. For newbies struggling to find the right R function as well as veterans who can't quite remember the function name, it's very handy. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] fitting gamma using glm
The data in Table 1, which is Table T.1 in Cox Snell's Applied Statistics, gives the intervals in service-hours between failures of the air-conditioning eequipment in 10 Boeing 720 jet aircraft. The following possible models are under consideration: (a) separate gamma distributions fitted to all aircraft, with 20 parameters; (b) separate gamma distributions with a common shape, with 11 parameters; (c) espearate exponential distributions to all aircraft (shape= 1, separate ), with 10 parameters; (d) common exponential distribution to all aircraft (shape = 1), with 1 parameter. http://www.utstat.toronto.edu/reid/sta410/hw2.pdf I am having trouble in fitting gamma to the 10 different airplanes using only one shape parameter. Hopefully, somebody can suggest a way to specify the model to be used in R. I tried to join all 10 datasets into 1, but the estimate I get in gamma.shape() is not reasonable. Thank you __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] number formatting
Dear R People: I have used the command round(x,3) to produce values with 3 places to the right of the decimal. Is there any command to remove the leading zero before the decimal point, please: that is, if I have 0.375, how do I produce just .375, please? Thanks in advance R 2.0.1 for Windows Sincerely, Laura Holt mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] number formatting
x - .001 x [1] 0.001 sub(+0, , x) [1] .001 Of course, that means you'll be storing this number as a character, but if you're looking to format how the number is printed, that's probably what you want. -Original Message- From: Laura Holt [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 2:43 PM To: r-help@stat.math.ethz.ch Subject: [R] number formatting Dear R People: I have used the command round(x,3) to produce values with 3 places to the right of the decimal. Is there any command to remove the leading zero before the decimal point, please: that is, if I have 0.375, how do I produce just .375, please? Thanks in advance R 2.0.1 for Windows Sincerely, Laura Holt mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] problems with Rd format
Dear R-helpers, I have an Rd file with a section: \details{ The model is:\cr \eqn{y | \lambda ~ Binomial(n, \lambda)},\cr [snip] } I would like the equation line to be indented, with a \tab character for example. How can I do that ? Moreover, the panel of greek letters available in HTML files generated from Rd files looks very limited (e.g., \eqn{\phi} produces phi, not the corresponding greek letter). Is there a way to overcome this in HTML files ? Thanks and best regards, Renaud System details: Win XP R version: _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor0.1 year 2004 month11 day 15 language R -- Dr Renaud Lancelot, vétérinaire C/0 Ambassade de France - SCAC BP 834 Antananarivo 101 - Madagascar e-mail: [EMAIL PROTECTED] tel.: +261 32 40 165 53 (cell) +261 20 22 665 36 ext. 225 (work) +261 20 22 494 37 (home) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] negative multinomial regression models
I am trying to find out the log-likelihood function of the negative multinomial. I would like to program a regression model for this distribution for a book I am writing. Any help I can obtain will be most appreciated. Joseph Hilbe [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] formatting output
On Mon, 2005-02-28 at 14:05 -0400, Peyuco Porras Porras . wrote: Dear R-users A basic question that I wasn't able to solve: Is it possible to get the results of the function 'quantile' expressed as data.frame? What I'm doing is to apply the following code to get the quantiles in a particular dataset: tmp-tapply(data$DEN,list(Age=data$AGE,Sex=data$SEX),quantile) and then I save this output to HTML using the library R2HTML. However in order to format the tables in HTML I have to use the command HTML.data.frame(...) which allows me to define, for example, the number of digits in the html table. But the object 'tmp' is not a dataframe and I can't coarce it to this format. Is it possible to get the results of this function as a dataframe? I know that I'm probably missing some important concepts here but Im not very good in programming. Any hint will be appreciated Here is one approach, using an expansion of one of the examples in ?tapply: # Get quantiles of 'breaks' for each combination of 'wool' and 'tension' my.tmp - tapply(warpbreaks$breaks, list(warpbreaks$wool, warpbreaks$tension), quantile) # Note that my.tmp is a 2 x 6 matrix of list elements # with each list element being the results of quantile # on each combination of 'wool' and 'tension' my.tmp L M H A Numeric,5 Numeric,5 Numeric,5 B Numeric,5 Numeric,5 Numeric,5 For example: my.tmp[1, 1] [[1]] 0% 25% 50% 75% 100% 25 26 51 54 70 Now get this into a manageable structure by taking each list element in my.tmp and converting it into a row in a new matrix, use: my.mat - do.call(rbind, my.tmp) my.mat 0% 25% 50% 75% 100% [1,] 25 26 51 54 70 [2,] 14 20 29 31 44 [3,] 12 18 21 30 36 [4,] 16 21 28 39 42 [5,] 10 18 24 28 43 [6,] 13 15 17 21 28 From there, you can set the rownames for the matrix, as you require, based upon the combinations of the vectors in your data. For example, using expand.grid(): my.names - expand.grid(dimnames(my.tmp)) my.names Var1 Var2 1AL 2BL 3AM 4BM 5AH 6BH rownames(my.mat) - paste(my.names$Var1, my.names$Var2, sep = :) my.mat 0% 25% 50% 75% 100% A:L 25 26 51 54 70 B:L 14 20 29 31 44 A:M 12 18 21 30 36 B:M 16 21 28 39 42 A:H 10 18 24 28 43 B:H 13 15 17 21 28 There might be an easier way, but that's my quick thought. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: R-help Digest, Vol 24, Issue 28
You've omitted a comma. races2000 is a data frame, which for purposes of extracting rows behaves like a 2-dimenional object. The following works fine: hills2000 - races2000[races2000$type == 'hill', ] Additionally, you might like to ponder type - races2000[names(races2000)==type] type[1:4] Error in [.data.frame(type, 1:4) : undefined columns selected length(type) # type is a data frame with 1 column [1] 1 vtype - unlist(type)# Extract the vector that is the one # data frame (list) element vtype[1:4] # Try also length(vtype) type.type1 type.type2 type.type3 type.type4 uphillotherotherrelay Your syntax (without the comma) does give a result, providing that the dimensions match (the condition must have the same number of elements as races2000 has columns), but it is probably not the result that you want! See further pp.320-321 of the DAAG book. John Maindonald email: [EMAIL PROTECTED] phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Bioinformation Science, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. On 28 Feb 2005, at 10:07 PM, [EMAIL PROTECTED] wrote: From: Clint Harshaw [EMAIL PROTECTED] Date: 28 February 2005 1:08:36 AM To: r-help@stat.math.ethz.ch Subject: [R] subsetting data set dimenion problem (See DAAG book, p. 173, ex. 3) I'm a new user of R, and I'm following the DAAG text. I want to create a subset of the races2000 data frame, but get errors because of a mismatch of values in some columns: library(DAAG) attach(races2000) hills2000 - races2000[races2000$type == 'hill'] Error in as.matrix.data.frame(x) : dim- : dims [product 770] do not match the length of object [771] However, if I follow the solution given, and remove redundant columns 1 through 6 and column 11 (which I won't need, since I know they are going to have the same value), I don't get the error: hills2000 - races2000[races2000$type == 'hill', -c(1:6,11)] hills2000 dist climb time timef Tiso Carnethy 6.00 2500 0.782 0.9191667 [...] Cornalees 5.50 800 0.618 NA [...] What is causing the error with my original subsetting? I speculated it was related to the NA values, but there is an NA in the resulting hills2000, corresponding to the Cornalees hill race. Thanks, Clint -- Clint Harshaw, PhD Department of Mathematics Presbyterian College Clinton SC 29325 EMail: [EMAIL PROTECTED] Phone: 864.833.8995 Fax: 864.938.3769 Office: Harrington-Peachtree Rm 412 John Maindonald email: [EMAIL PROTECTED] phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Bioinformation Science, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problems with Rd format
On Mon, 28 Feb 2005, Renaud Lancelot wrote: Dear R-helpers, I have an Rd file with a section: \details{ The model is:\cr \eqn{y | \lambda ~ Binomial(n, \lambda)},\cr [snip] } I would like the equation line to be indented, with a \tab character for example. How can I do that ? Well, use markup that allows \tab: if you want a table, use \tabular. But if you find yourself doing this, you are not in the spirit of layout languages, and Rd is a layout language. Moreover, the panel of greek letters available in HTML files generated from Rd files looks very limited (e.g., \eqn{\phi} produces phi, not the corresponding greek letter). Is there a way to overcome this in HTML files ? What HTML 4.0 _guarantees_ a browser can show is very limited, and does not include phi (at least according to my HTML 4.0 book). So, not in strict HTML. -- Brian D. Ripley, [EMAIL PROTECTED] 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Journal Quality R Graphs?
Hi! I have browsed the help archives but did not find anything on the subject: How to make publication quality graphs with R best? Is there some document about that topic out there? The problem is that the graphs look nice on the screen but when printed in black and white every color apart from black doesn't look very nice. Is there some guideline how to set color palettes and or fill patterns for charts? Thank you very much for considering my question in advance. Best, Werner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] (no subject)
Dear R Can you tell me how to change the working directory of R It's just that I have some text files that I wish to save separately from the R filing structure eg. into C:/my documents and need to change the working directory of R so that it reads these files . This means if I ever upgrade the current version of R nothing will be effected. brett Brett Stansfield Environmental Scientist - Water Quality Hawke's Bay Regional Council 102 Vautier Street Private Bag 6006 Napier Phone (06) 835-9200 extn 9334 Fax (06) 835-3601 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] (no subject)
help.search(working directory) The R folks have worked very hard to provide good documentation. Please make use of the Help system and other resources before posting, as the Posting Guide asks (below). -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brett Stansfield Sent: Monday, February 28, 2005 3:34 PM To: R help (E-mail) Subject: [R] (no subject) Dear R Can you tell me how to change the working directory of R It's just that I have some text files that I wish to save separately from the R filing structure eg. into C:/my documents and need to change the working directory of R so that it reads these files . This means if I ever upgrade the current version of R nothing will be effected. brett Brett Stansfield Environmental Scientist - Water Quality Hawke's Bay Regional Council 102 Vautier Street Private Bag 6006 Napier Phone (06) 835-9200 extn 9334 Fax (06) 835-3601 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Journal Quality R Graphs?
Please read the posting guide. As a minimum, you'll need to specify your OS and R version plus probably other particulars about what form the output must be in, etc. I am surprised that you were unable to find anything in the archives, as this is a frequent discussion topic. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Werner Wernersen Sent: Monday, February 28, 2005 3:27 PM To: r-help@stat.math.ethz.ch Subject: [R] Journal Quality R Graphs? Hi! I have browsed the help archives but did not find anything on the subject: How to make publication quality graphs with R best? Is there some document about that topic out there? The problem is that the graphs look nice on the screen but when printed in black and white every color apart from black doesn't look very nice. Is there some guideline how to set color palettes and or fill patterns for charts? Thank you very much for considering my question in advance. Best, Werner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] change working directory [was: (no subject)]
'help.search(working directory)' identifies getwd, the help file for which describes setwd. Similarly, www.r-project.org - search - R site search for working directory produced 564 hits. I checked the first 4, and they all mentioned either getwd or setwd. hope this helps. spencer graves Brett Stansfield wrote: Dear R Can you tell me how to change the working directory of R It's just that I have some text files that I wish to save separately from the R filing structure eg. into C:/my documents and need to change the working directory of R so that it reads these files . This means if I ever upgrade the current version of R nothing will be effected. brett Brett Stansfield Environmental Scientist - Water Quality Hawke's Bay Regional Council 102 Vautier Street Private Bag 6006 Napier Phone (06) 835-9200 extn 9334 Fax (06) 835-3601 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] formatting output
Marc Schwartz MSchwartz at MedAnalytics.com writes: : : On Mon, 2005-02-28 at 14:05 -0400, Peyuco Porras Porras . wrote: : Dear R-users : : A basic question that I wasn't able to solve: Is it possible to get : the results of the function 'quantile' expressed as data.frame? What : I'm doing is to apply the following code to get the quantiles in a : particular dataset: : : tmp-tapply(data$DEN,list(Age=data$AGE,Sex=data$SEX),quantile) : : and then I save this output to HTML using the library R2HTML. However : in order to format the tables in HTML I have to use the command : HTML.data.frame(...) which allows me to define, for example, the : number of digits in the html table. Note that HTML has numerous methods, not just HTML.data.frame. Issue the command: methods(HTML) to see them. : : But the object 'tmp' is not a dataframe and I can't coarce it to this : format. Is it possible to get the results of this function as a : dataframe? I know that I'm probably missing some important concepts : here but Im not very good in programming. : : Any hint will be appreciated : : Here is one approach, using an expansion of one of the examples in : ?tapply: : : # Get quantiles of 'breaks' for each combination of 'wool' and 'tension' : my.tmp - tapply(warpbreaks$breaks, :list(warpbreaks$wool, warpbreaks$tension), quantile) : : # Note that my.tmp is a 2 x 6 matrix of list elements : # with each list element being the results of quantile : # on each combination of 'wool' and 'tension' : : my.tmp : L M H : A Numeric,5 Numeric,5 Numeric,5 : B Numeric,5 Numeric,5 Numeric,5 : : For example: : : my.tmp[1, 1] : [[1]] : 0% 25% 50% 75% 100% : 25 26 51 54 70 : : Now get this into a manageable structure by taking each list element in : my.tmp and converting it into a row in a new matrix, use: : : my.mat - do.call(rbind, my.tmp) : : my.mat : 0% 25% 50% 75% 100% : [1,] 25 26 51 54 70 : [2,] 14 20 29 31 44 : [3,] 12 18 21 30 36 : [4,] 16 21 28 39 42 : [5,] 10 18 24 28 43 : [6,] 13 15 17 21 28 [...snipped off code to add row names...] Here is a slight variation of Marc's solution that avoids explicit setting of the row names: R my.tmp - split(warpbreaks$breaks, + list(warpbreaks$wool, warpbreaks$tension)) R my.tmp - lapply(my.tmp, quantile) R do.call(rbind, my.tmp) 0% 25% 50% 75% 100% A.L 25 26 51 54 70 B.L 14 20 29 31 44 A.M 12 18 21 30 36 B.M 16 21 28 39 42 A.H 10 18 24 28 43 B.H 13 15 17 21 28 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] formatting output
On Tue, 2005-03-01 at 01:21 +, Gabor Grothendieck wrote: snip Here is a slight variation of Marc's solution that avoids explicit setting of the row names: R my.tmp - split(warpbreaks$breaks, + list(warpbreaks$wool, warpbreaks$tension)) R my.tmp - lapply(my.tmp, quantile) R do.call(rbind, my.tmp) 0% 25% 50% 75% 100% A.L 25 26 51 54 70 B.L 14 20 29 31 44 A.M 12 18 21 30 36 B.M 16 21 28 39 42 A.H 10 18 24 28 43 B.H 13 15 17 21 28 Gabor, I had my head wrapped around trying to figure out a solution in a post hoc fashion. Didn't even think of splitting the data first. Better solution. Thanks, Marc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] packages masking other objects
hello all, I am trying to use the function getCovariateFormula(nlme) in conjunction with the library lme4. When I load both packages I get the following message and the getCovariateFormula function no longer works: library(nlme) library(lme4) Attaching package 'lme4': The following object(s) are masked from package:nlme : contr.SAS getCovariateFormula getResponseFormula groupedData lmeControl I have tried removing the package after using it, with: detach(package:lme4) library(nlme) but I still get an error message when I try to use getCovariateFormula. The line I use it in, and the error message is below: rownames(table)-c((getCovariateFormula(model1)),(getCovariateFormula(model2)),(getCovariateFormula(model3)),(getCovariateFormula(model4)),(getCovariateFormula(model5)),(getCovariateFormula(model6)),(getCovariateFormula(modelnull))) Error in switch(mode(x), NULL = structure(NULL, class = formula), : invalid formula This line works fine when I run models with different structures that are not in the lme4 package. Does anyone have any suggestions about this ? Am I not removing the package completely ? Any suggestions would be greatly appreciated Thanks James Smith __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] packages masking other objects
hello all, I am trying to use the function getCovariateFormula(nlme) in conjunction with the library lme4. When I load both packages I get the following message and the getCovariateFormula function no longer works: library(nlme) library(lme4) Attaching package 'lme4': The following object(s) are masked from package:nlme : contr.SAS getCovariateFormula getResponseFormula groupedData lmeControl I have tried removing the package after using it, with: detach(package:lme4) library(nlme) but I still get an error message when I try to use getCovariateFormula. The line I use it in, and the error message is below: rownames(table)-c((getCovariateFormula(model1)),(getCovariateFormula(model2)),(getCovariateFormula(model3)),(getCovariateFormula(model4)),(getCovariateFormula(model5)),(getCovariateFormula(model6)),(getCovariateFormula(modelnull))) Error in switch(mode(x), NULL = structure(NULL, class = formula), : invalid formula This line works fine when I run models with different structures that are not in the lme4 package. Does anyone have any suggestions about this ? Am I not removing the package completely ? Any suggestions would be greatly appreciated Thanks James Smith __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] packages masking other objects
James Smith james.smith at cdu.edu.au writes: : : hello all, : : I am trying to use the function getCovariateFormula(nlme) in conjunction with the library lme4. When I : load both packages I get the following message and the getCovariateFormula function no longer works: : : library(nlme) : library(lme4) : : Attaching package 'lme4': : : The following object(s) are masked from package:nlme : : : contr.SAS getCovariateFormula getResponseFormula groupedData lmeControl : : I have tried removing the package after using it, with: : detach(package:lme4) : library(nlme) : : but I still get an error message when I try to use getCovariateFormula. The line I use it in, and the error : message is below: : : rownames(table)-c((getCovariateFormula(model1)),(getCovariateFormula (model2)),(getCovariateFormula(model3)),(getCovariateFormula(model4)), (getCovariateFormula(model5)),(getCovariateFormula(model6)), (getCovariateFormula(modelnull))) : : Error in switch(mode(x), NULL = structure(NULL, class = formula), : : invalid formula : : This line works fine when I run models with different structures that are not in the lme4 package. : Does anyone have any suggestions about this ? : Am I not removing the package completely ? : Check out: ?:: __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Problems Building Ron AIX 5.2.0.0 (Solved)
Happily I got this to work, largely by trial-and-error. In hopes that this will help somebody else, my config.site ended up being: OBJECT_MODE=64 R_PAPERSIZE=letter CC=/usr/local/bin/gcc MAIN_LDFLAGS=-Wl,-brtl SHLIB_LDFLAGS=-Wl,-G Which is virtually identical to that recommended in R-admin: one of my problems was using -W1,brtl rather than -W1,-brtl. This was R 2.0.1 on AIX 5.2.0.0 with GCC 3.3.2 The previous messages I'd posted on this issue are included below. Paul My apologies -- I had believed that by linking the source message I had made the detailed context available. I will be more careful in the future to correctly give full context. Paul -Original Message- From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] Sent: Saturday, February 26, 2005 5:23 AM To: paul.boutros at utoronto.ca Cc: r-help at stat.math.ethz.ch Subject: Re: [R] Problems Building R on AIX 5.2.0.0 (Update) Quotes from messages about Solaris 9 are not necessarily applicable to AIX, and in omitting the context you have misrepresented me. Please do bear in mind the `moral rights' on quoting given at http://www.jiscmail.ac.uk/help/policy/copyright.htm (Perhaps such a reference is needed in the posting guide?) On Fri, 25 Feb 2005 paul.boutros at utoronto.ca wrote: Hi, My previous message is appended: I'm still struggling with building on AIX. I updated my config.site to follow the suggestions from R-admin: MAIN_LDFLAGS=-Wl,brtl SHLIB_LDFLAGS=-Wl,-G This led to an error during configure: checking whether mixed C/Fortran code can be run... configure: WARNING: cannot run mixed C/Fortan code configure: error: Maybe check LDFLAGS for paths to Fortran libraries? This confused me a bit, because before adding the MAIN_LDFLAGS and SHLIB_LDFLAGS to config.site this step of configure did not show an error. When I googled this I found a previous message from last year: http://tolstoy.newcastle.edu.au/R/help/04/04/1622.html At the end of this message Professor Ripley says: You need wherever libg2c.so is installed in your LD_LIBRARY_PATH. So... I went looking for this file and could not find it! In /usr/local/lib I have: $ ls -al libg2c* -rw-r--r-- 1 freeware staff 7751224 Jan 09 2004 libg2c.a -rwxr-xr-x 1 freeware staff 714 Jan 09 2004 libg2c.la But no libg2c.so appears to be on my system. Does this indicate a bad install of gcc, or could anybody offer any suggestions on where to go from here? Paul --- From: Paul Boutros Paul.Boutros_at_utoronto.ca Date: Thu 24 Feb 2005 - 02:43:52 EST Hello, I am trying to build R 2.0.1 on an AIX 5.2.0.0 machine using gcc 3.3.2: $ oslevel 5.2.0.0 $ gcc -v Reading specs from /usr/local/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/specs Configured with: ../gcc-3.3.2/configure : (reconfigured) ../gcc-3.3.2/configure --disable-nls : (reconfigured) ../gcc-3.3.2/configure --disable-nls Thread model: aix gcc version 3.3.2 Configure goes okay, but I get an error that I don't quite know how to interpret during make. I've included the summary output from the end of configure as well as the error that I get during make below. Any suggestions/recommendations are very much appreciate: I'm stuck on ideas for what could be going wrong. Paul $ ./configure --prefix=/db2blaste/R snip R is now configured for powerpc-ibm-aix5.2.0.0 Source directory: . Installation directory: /db2blast/R C compiler:gcc -mno-fp-in-toc -g -O2 C++ compiler: g++ -g -O2 Fortran compiler: g77 -g -O2 Interfaces supported: X11 External libraries: Additional capabilities: PNG, JPEG Options enabled: R profiling Recommended packages: yes configure: WARNING: you cannot build DVI versions of the R manuals configure: WARNING: you cannot build info or html versions of the R manuals configure: WARNING: you cannot build PDF versions of the R manuals configure: WARNING: I could not determine a browser configure: WARNING: I could not determine a PDF viewer $ make snip gcc -Wl,-bM:SRE -Wl,-H512 -Wl,-T512 -Wl,-bnoentry -Wl,-bexpall -Wl,- bI: . ./../../etc/R.exp -L/usr/local/lib -o lapack.so -Wl,-bI:../../../etc/Rlapack.exp Lapack.lo rgeev.lo rsyev.lo -L../../../lib -lRlapack -L/usr/local/lib -L/usr/ local/lib/gcc-lib/ powerpc-ibm-aix5.2.0.0/3.3.2 -L/usr/local/lib/gcc-lib/powe rpc- ibm-aix5.2.0.0/3.3.2/../../.. -lfrtbegin -lg2c -lm -lgcc_s /usr/local/lib/gcclib /powerpc-ibm-aix5.2.0.0/3.3.2/libgcc.a -lg -ldl -ltermcap -lm -lc ld: 0706-006 Cannot find or open library file: -l Rlapack ld:open(): A file or directory in the path name does not exist. collect2: ld returned 255 exit status make: 1254-004 The error
Re: [R] (no subject)
Reading the posting guide http://www.R-project.org/posting-guide.html will tell you to specify an informative subject line in your postings. You can change working directory by using setwd(), see help(setwd). For example setwd(c:\My Documents) might work. I am not sure if you need to truncate the path names to 8 characters anymore. But if you want to read files in other directory, you can do so without changing your current working directory. As long as you can supply the absolute or full path, you should be fine. For example read.delim(file=c:\My Documents\project1\datafile.txt) would read that file into R regardless of current directory. If you use absolute paths and if you saved the commands onto a script file, then you can re-execute these command under whatever version of R. I would recommend this approach since you will have a rather static working directory. Regards, Adai On Tue, 2005-03-01 at 12:33 +1300, Brett Stansfield wrote: Dear R Can you tell me how to change the working directory of R It's just that I have some text files that I wish to save separately from the R filing structure eg. into C:/my documents and need to change the working directory of R so that it reads these files . This means if I ever upgrade the current version of R nothing will be effected. brett Brett Stansfield Environmental Scientist - Water Quality Hawke's Bay Regional Council 102 Vautier Street Private Bag 6006 Napier Phone (06) 835-9200 extn 9334 Fax (06) 835-3601 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] variable importance in random forest
Hello, In Breiman papers on random forests 4 variable importance measures are described. as far as I can tell only two are available in the random forest R package. reduction in accuracy when the variable is permuted, and the mean decrease in the gini index due to the variable (no permutation). is this gini measure computed on the training set or the OOB cases?. in any event, Breiman actually seems to prefer a different measure based on average lowering of margin across all cases when the variable is permuted. is there any way to get this 'margin-based' variable importance measure from the result returned by the randomForest function? or do I have to use the original Breiman code to get access to this measure? I am using randomForest package release 4.3 many thanks Murad Nayal __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Journal Quality R Graphs?
Searching for graph publication on http://maths.newcastle.edu.au/~rking/R/ gave me the following hit : http://tolstoy.newcastle.edu.au/R/help/04/03/0202.html which suggests postscript(). Have you tried printing other documents in black and white on the same printer or tried different printers for the same R graph. This will hopefully eliminate printer as a possible culprit. Dying printer toners sometimes makes the graph look worse than it actually is. Regards, Adai On Tue, 2005-03-01 at 00:27 +0100, Werner Wernersen wrote: Hi! I have browsed the help archives but did not find anything on the subject: How to make publication quality graphs with R best? Is there some document about that topic out there? The problem is that the graphs look nice on the screen but when printed in black and white every color apart from black doesn't look very nice. Is there some guideline how to set color palettes and or fill patterns for charts? Thank you very much for considering my question in advance. Best, Werner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] (no subject)
Sorry, all backslashes have to be doubled in R as mentioned in FAQ 2.14 http://cran.r-project.org/bin/windows/base/rw-FAQ.html#R-can_0027t-find- my-file Regards, Adai On Tue, 2005-03-01 at 04:33 +, Adaikalavan Ramasamy wrote: Reading the posting guide http://www.R-project.org/posting-guide.html will tell you to specify an informative subject line in your postings. You can change working directory by using setwd(), see help(setwd). For example setwd(c:\My Documents) might work. I am not sure if you need to truncate the path names to 8 characters anymore. But if you want to read files in other directory, you can do so without changing your current working directory. As long as you can supply the absolute or full path, you should be fine. For example read.delim(file=c:\My Documents\project1\datafile.txt) would read that file into R regardless of current directory. If you use absolute paths and if you saved the commands onto a script file, then you can re-execute these command under whatever version of R. I would recommend this approach since you will have a rather static working directory. Regards, Adai On Tue, 2005-03-01 at 12:33 +1300, Brett Stansfield wrote: Dear R Can you tell me how to change the working directory of R It's just that I have some text files that I wish to save separately from the R filing structure eg. into C:/my documents and need to change the working directory of R so that it reads these files . This means if I ever upgrade the current version of R nothing will be effected. brett Brett Stansfield Environmental Scientist - Water Quality Hawke's Bay Regional Council 102 Vautier Street Private Bag 6006 Napier Phone (06) 835-9200 extn 9334 Fax (06) 835-3601 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Creating matrices for Mantel test
This seems like a real simple question - but I am not finding the answer in the help files and manuals. I am not a real sophisticateduser of R so maybe that is why I cant seem to get this. Anyway - I ne= ed to create matrices for doing a Mantel test on my data which was collecte= d in a 5 by 8 grid. I would appreciate any help in how to make this h= appen. I am using the Mantel test that I found in the APE library. Thank you in advance for your help. nbs= p; Scott Meers __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problems with Rd format
Prof Brian Ripley a crit : On Mon, 28 Feb 2005, Renaud Lancelot wrote: Dear R-helpers, I have an Rd file with a section: \details{ The model is:\cr \eqn{y | \lambda ~ Binomial(n, \lambda)},\cr [snip] } I would like the equation line to be indented, with a \tab character for example. How can I do that ? Well, use markup that allows \tab: if you want a table, use \tabular. But if you find yourself doing this, you are not in the spirit of layout languages, and Rd is a layout language. Moreover, the panel of greek letters available in HTML files generated from Rd files looks very limited (e.g., \eqn{\phi} produces phi, not the corresponding greek letter). Is there a way to overcome this in HTML files ? What HTML 4.0 _guarantees_ a browser can show is very limited, and does not include phi (at least according to my HTML 4.0 book). So, not in strict HTML. Thanks for your reply. I got a nice result (in text and HTML) with: \details{ The model is:\cr \tabular{lll}{ \tab \tab \eqn{y | \lambda ~ Binomial(n, \lambda)}, with \eqn{\lambda ~ Beta(S1, S2)},\cr [snip] } [snip] } What would be a solution in the spirit of layout languages ? Best, Renaud -- Dr Renaud Lancelot, vtrinaire C/0 Ambassade de France - SCAC BP 834 Antananarivo 101 - Madagascar e-mail: [EMAIL PROTECTED] tel.: +261 32 40 165 53 (cell) +261 20 22 665 36 ext. 225 (work) +261 20 22 494 37 (home) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Sweave and \input or \include LaTeX commands
Hi! What is wrong if there would be the same command? Recall my example from previous posts and at the end of this mail. If I have a file a.Rnw and this one inputs file a1.Rnw. My idea was that Sweave would check \input{a1} or \include{a1} statements. If file a1 would have extension .Rnw it would parse it otherwise (i.e. having .tex) it would skip it. Sweave would just parse .Rnw files, while latex would put all of them in one file during typesetting. Example: - we have files a.Rnw, which has \input{a1} or \include{a1} a1.Rnw - run Sweave(a.Rnw) and you get a.tex a1.tex - run LaTeX (i.e. texi2dvi --pdf a.tex) and you get a.pdf Having new command i.e. \SweaveInput{} would also do the job perfectly, however I don't se any new benefits of it. One should write more or less the same R code as for \input or \include. --- [...] Gabor Since this might not be desirable in all instances, if Sweave were to have an include facility then it should not be implemented in such a way that the latex include facility can no longer be used. The point was just that it should be possible to do the include at the Sweave or at the latex level. Friedrich I agree that it should not be the same command. I have put an \SweaveInput{} on my 2do list, should be doable for R 2.1.0. -- Lep pozdrav / With regards, Gregor GORJANC --- University of Ljubljana Biotechnical FacultyURI: http://www.bfro.uni-lj.si/MR/ggorjan Zootechnical Department mail: gregor.gorjanc at bfro.uni-lj.si Groblje 3 tel: +386 (0)1 72 17 861 SI-1230 Domzale fax: +386 (0)1 72 17 888 Slovenia, Europe --- : Imagine this situation: : : % --- a.Rnw start --- : \documentclass{book} : \usepackage{Sweave} : \begin{document} : % some toy example : print=TRUE= : x - 1:10 : at : % now we input additional file : \input{a1} : % and lets look again at x : print=TRUE= : x : at : \end{document} : % --- a.Rnw end --- : : % --- a1.Rnw start --- : %\usepackage{Sweave} : % add 1 to x : print=TRUE= : x - x + 1 : at : % --- a1.Rnw end --- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] packages masking other objects
James Smith wrote: hello all, I am trying to use the function getCovariateFormula(nlme) in conjunction with the library lme4. When I load both packages I get the following message and the getCovariateFormula function no longer works: library(nlme) library(lme4) Attaching package 'lme4': The following object(s) are masked from package:nlme : contr.SAS getCovariateFormula getResponseFormula groupedData lmeControl So you don't have the most recent version of lme4 which tells you instead: library(nlme) library(lme4) Loading required package: Matrix Loading required package: latticeExtra Error in fun(...) : Package lme4 conflicts with package nlme. To attach lme4 you must restart R without package nlme. Error: .onLoad failed in loadNamespace for 'lme4' Error in library(lme4) : package/namespace load failed for 'lme4' So the answer is: Don't do that. Uwe Ligges I have tried removing the package after using it, with: detach(package:lme4) library(nlme) but I still get an error message when I try to use getCovariateFormula. The line I use it in, and the error message is below: rownames(table)-c((getCovariateFormula(model1)),(getCovariateFormula(model2)),(getCovariateFormula(model3)),(getCovariateFormula(model4)),(getCovariateFormula(model5)),(getCovariateFormula(model6)),(getCovariateFormula(modelnull))) Error in switch(mode(x), NULL = structure(NULL, class = formula), : invalid formula This line works fine when I run models with different structures that are not in the lme4 package. Does anyone have any suggestions about this ? Am I not removing the package completely ? Any suggestions would be greatly appreciated Thanks James Smith __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html