Re: [R] Changing font in boxplots
Hi John, Thanks so much for such a quick reply. I have tried to set all to Times font running par(font.lab=6) (not 4, maybe this is a local setting on my machine?) but now the boxplot shown has the x and y labels in Times New Roman and the x and y axis still in Arial. Any idea why R is not setting those in Times? Try par(font.axis=6) Thanks a lot for your advice, Graziella --On 08 August 2007 09:16 -0400 John Kane [EMAIL PROTECTED] wrote: I don't know if boxplot will accept a font argument.m From ?boxplot it is not clear. You may need to set the par() command before the boxplot Example: par(font.lab=4) boxplot(mass ~ family, data=mydata, ylab=mass %, xlab=family,las=1, cex.axis=1) --- G Iossa, School Biological Sciences [EMAIL PROTECTED] wrote: Hi all, I am very new to R and this might be a simple question but I have looked everywhere you suggest before writing to you. I am trying to change font type from san-serif to a serif (Times New Romans) on all labels and axis of my boxplot. I have used this function in other plots before, e.g.: plot(residuals~lnlifespan, data=mydata, pch=psymb, font=6, xlab=ln reproductive lifespan, ylab=residuals ln mass, font.lab=6, cex=1.5, cex.axis=1.5, cex.lab=1.5) and found that font.lab or font.axis=6 gives Times font. However, when I try for boxplot: boxplot(mass ~ family, data=mydata, ylab=mass %, xlab=family, font.axis=6, font=6, par(las=1), cex.axis=1) it does not work (R does not give any warning messages). I have also tried family=Times but without success. Any idea of why is not doing it and what I can do to get Times font on my boxplot? I run R on Windows. Thanks a lot, Graziella * Dr. Graziella Iossa Mammal Research Unit School Biological Sciences University of Bristol Woodland Road Bristol BS8 1UG, UK E-mail: [EMAIL PROTECTED] Tel 0044 (0)117 9288918 Fax 0044 (0)117 3317985 http://www.bio.bris.ac.uk/research/mammal/index.html http://www.bio.bris.ac.uk/people/Iossa.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com * Dr. Graziella Iossa Mammal Research Unit School Biological Sciences University of Bristol Woodland Road Bristol BS8 1UG, UK E-mail: [EMAIL PROTECTED] Tel 0044 (0)117 9288918 Fax 0044 (0)117 3317985 http://www.bio.bris.ac.uk/research/mammal/index.html http://www.bio.bris.ac.uk/people/Iossa.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. --- Scanned by M+ Guardian Messaging Firewall --- HTH Rob __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] dataframe layout
Can someone remind me how to change the columns in df.a into a two column df.b that contains one column of data and another column of the original column headings as levels. Example: a=1:3 b=4:6 c=7:9 df.a=data.frame(a,b,c) Should become in df.b: dat lev 1 a 2 a 3 a 4 b 5 b 6 b 7 c 8 c 9 c Thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R for copying and pasting selected image files?
You don't tell us your OS, but the system() command should let you use your OS to copy/move files on most OSs. see ?system Other commands that might be helpful for this job are: ?setwd ?getwd ?dir - Original Message - From: Kim Milferstedt [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, March 12, 2007 8:33 AM Subject: [R] R for copying and pasting selected image files? Hello, I would like to use R to process a list of text strings. The text strings are filenames, encoding experimental settings. Based on the information in there I'd like to select certain files and copy only the selected files to another directory. The files are images and there is no need, actually no desire, to open them. Is there a way to use R for copying and pasting files with any file extension to another directory without opening them? Thanks already for any help, Kim __ Kim Milferstedt University of Illinois at Urbana-Champaign Department of Civil and Environmental Engineering 4125 Newmark Civil Engineering Laboratory 205 North Mathews Avenue MC-250 Urbana, IL 61801 USA phone: (001) 217 333-9663 fax: (001) 217 333-6968 email: [EMAIL PROTECTED] http://cee.uiuc.edu/research/morgenroth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Examples on how to READ/WRITE to database using R-Project
We are working on a project on forecast modeling and would like to know if there are any examples on how to READ/WRITE to a database (e.g. PostgreSQL) using R-Project. I do have a sample R Script which takes input as files from a directory and writes back output files to a directory. I would like to convert this script to read from a database and write back the output to a database. - Venkatesh Mantha You probably want to install the RODBC package. Then, library(RODBC) ?RODBC Also, the the relational database section of the R Data Import/Export Manual is worth reading: http://cran.r-project.org/doc/manuals/R-data.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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] simpleR or usingR package by Verzani
I think the name of what you want is simple.freqpoly() Try: library(UsingR) ?simple.freqpoly HTH, Rob Baer I am a new R user and so I thought I could start with Using R for Introductory statistics by Verzani. In order to use some of the functions and datasets I have to install the simpleR package which is is now inside the UsingR package. I did so using install.packages(UsingR). However, the functions such as simple.freqpoly.R do not work. I also tried to install the Simple_0.4.zip available by the author, but I get the following message: Error in gzfile(file, r) : unable to open connection In addition: Warning messages: 1: error 1 in extracting from zip file 2: cannot open compressed file 'Simple/DESCRIPTION' I should also note that I use windows XP and the latest R version. Any suggestions? Thank you!! __ Danmarks Fiskeriundersøgelser er den 1.1.07 fusioneret med Danmarks Tekniske Universitet (DTU), Forskningscenter Risø, Danmarks Fødevareforskning, Danmarks Rumcenter og Danmarks Transportforskning. DTU er den fortsættende enhed. Læs mere om fusionen på www.detnyedtu.dk As of 1 January 2007 The Danish Institute for Fisheries Research has merged with the Technical University of Denmark, Risø National Laboratory, the Danish Institute for Food and Veterinary Research, the Danish National Space Centre and the Danish Transport Research Institute. The Technical University of Denmark (DTU) is the continuing unit. More information on www.detnyedtu.dk [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] axis command and excel time format
You should look at ?plot.default ?times You need to supply an x vector (time) along with a y value vector of the same length. Your error message tells you that you vectors were not of equal length. You are repeatedly supplying different length vectors. times() takes a text vector and translates it into an object of class time. Try the following to see if it unscrambles things for you. You can go on to suppress axis labels, etc. by using other arguments as necessary . xrange=times(c(2:25:00,3:14:00)) yrange=c(0,10) plot(xrange,yrange,type='n') - Original Message - From: Carmen Meier [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, November 10, 2006 5:13 AM Subject: Re: [R] axis command and excel time format Carmen, Gabor has already given you the detail you ask for, but might try the following plot to see what is going wrong: plot(times(tt), x, type='l') This does not give you the EXACT control of the axis you asked for, but this simple plot command gives you a fairly nice result. It illustrates that your code is failing becasue you are plotting x against the index of x rather than plotting x against time. At least this is what I think the misunderstanding is. Thank you Robert, this is nearly what I need, but my problem is that I need an empty window with axes. I am able to build this with any data but not with the time axis. I need for a special issue only horizontal lines with different colors and arrows, which will be inserted from a function. Maybe you could explain me what's the difference between library(zoo) library(chron) time - c(2:25:00,2:26:00,2:27:00,2:28:00,2:29:00,2:30:00,2:31:00, 2:32:00,2:33:00,2:34:00,2:35:00,2:36:00,2:37:00,2:38:00, 2:39:00,2:40:00,2:41:00,2:42:00,2:43:00,2:44:00,2:45:00, 2:46:00,2:47:00,2:48:00,2:49:00,2:50:00,2:51:00,2:52:00, 2:53:00,2:54:00,2:55:00,2:56:00,2:57:00,2:58:00,2:59:00, 3:00:00,3:01:00,3:02:00,3:03:00,3:04:00,3:05:00,3:06:00, 3:07:00,3:08:00,3:09:00,3:10:00,3:11:00,3:12:00,3:13:00, 3:14:00) y - c(0,10) plot(times(time), y, type='n') - error in xy.coords(x, y, xlabel, ylabel, log) :'x' and 'y' lengths differ - the error is only with type='n' and not with type='l' and the example without errors library(zoo) library(chron) time - c(2:25:00,2:26:00,2:27:00,2:28:00,2:29:00,2:30:00,2:31:00, 2:32:00,2:33:00,2:34:00,2:35:00,2:36:00,2:37:00,2:38:00, 2:39:00,2:40:00,2:41:00,2:42:00,2:43:00,2:44:00,2:45:00, 2:46:00,2:47:00,2:48:00,2:49:00,2:50:00,2:51:00,2:52:00, 2:53:00,2:54:00,2:55:00,2:56:00,2:57:00,2:58:00,2:59:00, 3:00:00,3:01:00,3:02:00,3:03:00,3:04:00,3:05:00,3:06:00, 3:07:00,3:08:00,3:09:00,3:10:00,3:11:00,3:12:00,3:13:00, 3:14:00) y - c(0,10) plot(times(time), y, type='l') It is not the type='n' every other combination of data types which i tried was working with the no plot option y - c(0,10) z - c(0,10) plot(z, y, type='n') Carmen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] axis command and excel time format
Carmen, Gabor has already given you the detail you ask for, but might try the following plot to see what is going wrong: plot(times(tt), x, type='l') This does not give you the EXACT control of the axis you asked for, but this simple plot command gives you a fairly nice result. It illustrates that your code is failing becasue you are plotting x against the index of x rather than plotting x against time. At least this is what I think the misunderstanding is. HTH Please provide a complete self contained example. I can't follow the partial code below; however, its likely you are plotting one thing and creating axes using another so there is no reason it should come out right. On 11/8/06, Carmen Meier [EMAIL PROTECTED] wrote: Gabor Grothendieck schrieb: Your code plots x which has nothing to do with xt. The same result if you change xt to x: 02:25 at the origin nothing else - I do not know why #-- your suggestion mn - times(min_time) mx - times(max_time) n - 12 t - times(seq(mn, mx, length = n)) t - times(unique(sub(..$, 00, t))) axis(1, x, sub(:00$, , x)) # works only with plot data before Regards Carmen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] unexpected read.csv behavior
Example data in a recent post was: LandFill Ruminants United States (USA) .214280 5528.16 France 200.527083 1299.87 Australia185.878368 2448.17 Russian Federation 1752.833400 2024.29 Argentina283.987320 2567.02 Brazil 1048.422480 8839.61 Colombia 265.125000 1307.61 Mexico 981.023351 1814.89 Ethiopia 9.380204 1237.49 Sudan 16.018494 1796.67 India553.425328 12360.30 Pakistan 47.159393 2346.71 China455.680191 8041.79 In trying to play with this posting, I saved the data as a .csv file where the first row had only two entries and read: , LandFill, Reminants I tried reading the data in with read.csv(ex.csv, header=TRUE) To my surprise this created a 3 column dataframe with the first column labeled as X. X was a factor. According to the help file: If there is a header and the first row contains one fewer field than the number of columns, the first column in the input is used for the row names. Otherwise if row.names is missing, the rows are numbered. I got the expected default behavior of having the unlabeled column become row labels when I tried, read.csv(ex.csv, header=TRUE, row.names=1) Is this unexpected behavior somehow related to how I designed a .csv file or is there something I'm misinterpreting in the documentation? Thanks, Rob Baer version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 4.0 year 2006 month 10 day03 svn rev39566 language R version.string R version 2.4.0 (2006-10-03) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Labels for Points- 2 character labels?
I think you want to use text() x=1:15; y=16:30 plot(x,y) text(x,y, as.character(x), pos=4) - Original Message - From: ableape [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Wednesday, October 18, 2006 4:59 PM Subject: [R] Labels for Points- 2 character labels? I would like to be able to label each point in a scatter plot with the numeric order of that point. for example, I create the following plot: plot(e,n) # # now I go back and create my labels # for(i in 1:length(e)) {# lets say e 10 pc - as.character(e_order[i]) # e_order has an integer array 1,4,3,2... which is the order of e points(e15[i], n15[i],pch=pc)# this will plot 0-9 as data labels } # The above works for single characters. Now if the length of e[] is greater than 9, the character string converted by as.character will yield more than one digit. At this point, my labeling trick fails:-( 1) is there a way to create two character labels for a plot? 2) Or even better, is there a way to do what I am trying to do. Label each point by its numeric order? Thanks for your help. Renaldo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] frequency table
Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA - Original Message - z = rep(c(M,F),c(50,60)) How can I get the following frequency table: Sex counts % F60 54.5 M 50 45.5 How about: data.frame(table(z),percent=100*as.vector(table(z)/sum(table(z HTH, Rob __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to construct stripchart with coincident points centered
You may be looking for: stripchart(y, method=jitter, pch=o, vertical=TRUE,jitter=.5) Rob Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA - Original Message - From: Berta [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, September 08, 2006 3:53 AM Subject: [R] how to construct stripchart with coincident points centered Hi R-users, I am using stripchart with coincident points, y -rbinom(100, 3, 0.5) stripchart(y, method=stack, pch=o, vertical=TRUE) But the result is not centered in the sense that if a value (say value 0) is repeated 7 times, the first point is ploted in the middle and the rest at its right side, in stead of ploting 3 at its right and 3 at its left. Can anybody help? Thanks, Berta. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] I am surprised (and a little irritated)
Detlef Steuer [EMAIL PROTECTED]write: I`m the one to blame for the readme :-) and for providing the rpms. If you encounter such big problems my readme sucks. But I'm open for critisism and will improve on the current situation for the release of R-2.3.0 next monday. Even as you sit under seige, let me take this opportunity to thank you (and ALL the other countless developers, maintainers and list contributers) for the TIRELESS work you do to make R one of the most robust open source projects I know about. We the 'end users'. are indebted for your energies and talents in ways most of us can never even contemplate. Thanks to you all for your service to the greater good, and for being willing to step up and incrementally strive for excellence. Rob Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA __ 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] R, RMysql, and MySQL 5 Decimal Type Support
Whenever I have a MySQL query that returns a Decimal result to R I get the following warning in R: I get this for a simple query like SELECT 2, 2.5 !! Warning message: RS-DBI driver warning: (unrecognized MySQL field type 246 in column 1) If I understand what you are saying, I think you have garbled SQL syntax. The select statement synatx is: SELECT list_of_columns FROM tables[s] [WHERE search_conditions] My guess is that you don't have columns named 2 or 2.5 Rob Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA - Original Message - From: Jason Trimble [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tuesday, March 28, 2006 12:08 PM Subject: [R] R, RMysql, and MySQL 5 Decimal Type Support Hi, I am using: R ver 2.1.1 RMySQL ver. 0.5-7 DBI ver. 0.1-10 MySQL Ver 14.12 Distrib 5.0.18. Please Help! Jason [[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] How to use: library lattice: barchart
it looks totaly different and I get the error message: x should be numeric in: bwplot.formula(x = ayield ~ avariety | asite, data = list(ayield = c(2, --- cbind(some numeric and not numeric columns) gives you all columns to be character and when you make data.frame from it it is converted to factors. so abarley = data.frame(ayield,avariety,ayear,asite) brings you close but than you need ayear to be factor. Either convert it in data frame or on fly Actually, as the warning suggests, you have all factors in the dataframe but you need to convert ayield to a numeric. Something like, abarley = data.frame(cbind(as.numeric(ayield),avariety,ayear,asite)) barchart(ayield ~ avariety | asite, data = abarley, groups = factor(ayear), layout = c(1,5) ) HTH Petr Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA __ 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] Surv object in data.frame
This does work: coxph(survobj~group, data=df.test[[1]]) # this works like your original To get insight compare: str(survobj) str(df.test) str(df.test[[1]]) Then note the 2nd sentence of the following from ?coxph Arguments: formula: a formula object, with the response on the left of a '~' operator, and the terms on the right. The response must be a survival object as returned by the 'Surv' function. Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA Dear All, a Surv object I put in a data frame behaves somehow unexpected (see example). If I do a Cox regression on the original Surv object it works. If I put it in a data.frame and do the regression on the data frame it does not work. Seemingly it has to do with the class attribute, because if I change the class attribute to let Surv appeare first, again it works. Is this known? Should I have found information on it? Any comments? Thanks Heinz Tüchler ## example data starttime - rep(0,5) stoptime - 1:5 event - c(1,0,1,1,1) group - c(1,1,1,2,2) ## Surv object survobj - Surv(starttime, stoptime, event) ## Cox-regression coxph(survobj~group) # this works ## put Surv object in data.frame df.test - data.frame(survobj=I(survobj), group) ## Cox-regression on data.frame coxph(survobj~group, data=df.test) # this does not work attr(df.test$survobj, 'class') # survobject has class AsIs, Surv attr(df.test$survobj, 'class') - c('Surv', 'AsIs') # put Surv first attr(df.test$survobj, 'class') # survobject has class Surv, AsIs coxph(survobj~group, data=df.test) # now it works __ 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] 2 barplots in the same graph
See ?barplot If I understand what you want, try: barplot(x1,border=red,density=0) par(new=TRUE) barplot(x2,border=green,density=0) Rob Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA - Original Message - From: jia ding [EMAIL PROTECTED] To: R-help r-help@stat.math.ethz.ch Sent: Wednesday, February 22, 2006 7:31 AM Subject: [R] 2 barplots in the same graph Hello, I have a very simple question about 2 barplots in the same graph. It seems quite easy, but I searched google for long time, haven't find solution. For example, I want one graph like: x1=seq(0,2,by=0.3) x2=seq(3,0,by=-0.1) barplot(x1,col=red) barplot(x2,col=green) It means if it's on the same graph, some bars are overlaped. So if the bars are hollow, instead of filled with color, it will be better. Actually, I think it's something similar with matlab's hold on command. Thanks! Nina [[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] print formula on plot
Only put the expression inside the expression? plot(x,z[3]*x^2+z[2]*x+z[3],type=l, main=My nice plot) text(-0.9,5,paste(zs[1],' ',expression(x^3))) # should work Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA - Original Message - From: Thomas Steiner [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Wednesday, February 08, 2006 7:47 AM Subject: [R] print formula on plot I estimate some parameters and I want to print them (pretty) on my plot: # somehow estimated parameters z-c(1.543523e+00, 1.23453e+00, 3.454000e+00) x-seq(-1,1,length=100) plot(x,z[3]*x^2+z[2]*x+z[3],type=l, main=My nice plot of the estimated function) zs-format(z,digits=4,scientific=FALSE,trim=TRUE) text(-0.9,7,expression(1.54*x^2)) # is what I want, but DYNAMIC text(-0.9,6,expression(paste(zf[1],x^3))) # not really text(-0.9,5,expression(paste(toSting(zf[1]),x^3))) # not really #using z (double) instead of zf (string) does not help. So my question is: How do I evaluate zf[1] from the variable to it's (String) value? Here it is used within an expression: this makes all the trouble. Thanks for help, I tried 2 hrs now... Thomas __ 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] Newbie question on using friedman.test()
?friedman.test Says: Description: Performs a Friedman rank sum test with unreplicated blocked data. Usage: friedman.test(y, ...) y: either a numeric vector of data values, or a data matrix. So assuming your data, d, is unreplicated blocked data, perhaps d=as.matrix(d) friedman.test(d) or simply, friedman.test(as.matrix(d)) ??? Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA - Original Message - From: Bill Kules [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tuesday, January 17, 2006 12:16 PM Subject: [R] Newbie question on using friedman.test() I am trying to use the friedman.test() on a data frame, d, but I am receiving the following error message: d AW HS IAC WA 1 6 8 3 5 2 2 2 3 6 3 7 7 8 3 4 8 5 4 5 20 2 5 2 7 21 7 7 6 7 22 7 8 6 8 23 6 8 4 5 24 5 7 5 2 friedman.test(d) Error in any(is.na(groups)) : argument groups is missing, with no default I think I just need to convert the data frame to a matrix, and then friedman.test() will get the roups and blocks automatically. Question 1) Is my understanding correct? Question 2) What R function will convert the data frame to the matrix I need? I'm still figuring out the matrix functions, and I would appreciate any pointers or examples. The help() section is sometimes a bit terse... Thanks in advance from a Newbie, Bill PS - to recreate the above data frame d: d - structure(list(AW = as.integer(c(6, 2, 7, 8, 8, 8, 7, 5, 3, 6, 8, 7, 6, 4, 8, 7, 8, 7, 7, 2, 7, 7, 6, 5)), HS = as.integer(c(8, 2, 7, 5, 4, 5, 7, 7, 2, 8, 4, 7, 8, 7, 6, 7, 5, 8, 8, 5, 7, 8, 8, 7)), IAC = as.integer(c(3, 3, 8, 4, 7, 5, 8, 3, 4, 3, 7, 4, 6, 5, 6, 7, 8, 6, 8, 2, 6, 6, 4, 5)), WA = as.integer(c(5, 6, 3, 5, 3, 6, 7, 8, 3, 5, 6, 7, 7, 7, 7, 6, 4, 7, 8, 7, 7, 8, 5, 2))), .Names = c(AW, HS, IAC, WA), row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ), class = data.frame) Bill Kules Principal, Takoma Software, Inc., Takoma Park, MD www.takomasoftware.com Ph.D. Candidate, University of Maryland Human-Computer Interaction Lab www.cs.umd.edu/hcil [EMAIL PROTECTED] (301) 405-2725 voice (301) 891-7271 voice + voicemail (301) 891-7273 fax (301) 755-7982 mobile __ 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] ylim problem in barplot
PaulB When I use barplot but select a ylim value greater PaulB than zero, the graph is distorted. The bars extend PaulB below the bottom of the graph. PaulB For instance the command produces a problematic graph. PaulB barplot(c(200,300,250,350),ylim=c(150,400)) Well, my question would be if that is not a feature :-) Many people would consider barplots that do not start at 0 as Cheating with Graphics (in the vein of Lying with Statistics). Well, consider this example: barplot(c(-200,300,-250,350),ylim=c(-99,400)) It seems that barplot uses ylim and pretty to decide things about the axis but does some slightly unexpected things with the bars themselves that are not just at the 'zero' end of the bar. Rob Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA __ 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] forrest plot
Try: metaplot(mn=c(-0.28174,-0.71444,-0.12375,-0.12426,-0.30011,-0.45058,-0.07324 ),se=c(0.20766,0.42691,0.26366,0.30357,0.31819,0.28636,0.37758),xlab=HR and 95%CI,logeffect=T,xaxt=n,xlim=c(-1.7,1.7)) axis(side=1,at=c(0.2,0.3,0.6,1.0,1.4,2.0,3.0,5.4),labels=c(0.2,0.3,0.6,1.0,1 4,2.0,3.0,5.4)) Rob Robert W. Baer, Ph.D. Associate Professor Department of Physiology A. T. Still University of Health Science 800 W. Jefferson St. Kirksville, MO 63501-1497 USA - Original Message - From: Michela Ballardini [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Thursday, October 20, 2005 8:55 AM Subject: [R] forrest plot Hello I'm trying to plot hazard risk values using the function metaplot with the specifications: metaplot(mn=c(-0.28174,-0.71444,-0.12375,-0.12426,-0.30011,-0.45058,-0.07324 ),se=c(0.20766,0.42691,0.26366,0.30357,0.31819,0.28636,0.37758),xlab=HR and 95%CI,logeffect=T,xaxt=n) axis(side=1,at=c(0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0),labels=c(0,0.2,0 4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0)) However, in the plot the x axis is on a log scale and tends to overextend the left end of the axis. How can I transform the x-scale on a linear scale with equidistant points? Thank you very much for your attenction Mic ** Dr.ssa Michela Ballardini Unità di Biostatistica e Sperimentazioni Cliniche c/o Osp. Morgagni-Pierantoni - Pad. Valsalva Via Forlanini, 34 47100 Forlì Tel 0543-731836 Tel/Fax 0543-731612 ** [[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] Dunn's post hoc test
I think Martin told you the basic approach to the indexing: averank-sort(sample(1:100,25,replace=TRUE)) averank[-1] - averank[-length(averank)] [1] 1 1 6 3 4 14 1 1 8 1 2 6 5 4 10 0 3 2 1 11 1 1 2 0 averank [1] 4 5 6 12 15 19 33 34 35 43 44 46 52 57 61 71 71 74 76 77 88 89 90 92 92 - Original Message - From: IAIN GALLAGHER [EMAIL PROTECTED] To: Martin Henry H. Stevens [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Monday, October 17, 2005 2:29 PM Subject: Re: [R] Dunn's post hoc test Thanks for your reply Hank. It's not really what I'm after (though it's good to know). For the test ( as described in Statistics for the Biosciences by W. Gardiner. Prentice Hall, 1997) I have to rank my groups, calculate the average rank, then subtratc each average rank from every other. Any value greater than the test statistic is significant. eg average rank difference table: 2 5 89 ---|-- 2 - 3 67 | 5 - - 34 | 8 - - -1 | 9 - - -- | I can't get my head around writing an algorithm for this if I have a vector of average ranks eg averank- c(2,5,8,9). I know I can address the vector by index and that this is probably the correct route but I can't get the indexing algorithm right! I'm sure someone will point out somethng simple and I'll kick myself but the help would be appreciated. Thanks again. Iain Gallagher --- Martin Henry H. Stevens [EMAIL PROTECTED] wrote: I don't know Dunn's rank test, but the following substracts each of the sums of averanks from the next rank. cumsum(averank)[-length(averank)] - averank[-1] Hank On Oct 17, 2005, at 4:30 AM, Iain Gallagher wrote: Hi Everyone. I am rather new to R and I've been trying to implement a function to carry out the above test. For a couple of days now I've been stuck on how to generate average rank differences. Say I have a vector of average ranks: averank- c(2,5,9,12) I would like to subtract averank[1] from averank[2], averank[1] and averank[2] from averank[3] and averank[1], averank[2] and averank[3] from averank[4] etc (I know the syntax is wrong here... it's just for illustration) but I can't work out how to do it. Ideally I would like to generate an array showing the differences between the average ranks so I could tell at a glance which ones were greater than my critical value I've been looking at loops etc but it's a little beyond me at the moment. Thanks for any suggestions. Iain Gallagher IIIR Edinburgh University __ 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 Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ 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] Dunn's post hoc test
I think I misunderstood your follow-up question. Try this: averank-sort(sample(1:100,10,replace=TRUE)) x=matrix(nrow=length(averank),ncol=length(averank)) for (i in 1:length(averank)){ + for (j in 1:length(averank)){ + x[i,j] - averank[i] - averank[j] + }} x [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]0 -14 -15 -16 -16 -23 -37 -51 -67 -79 [2,] 140 -1 -2 -2 -9 -23 -37 -53 -65 [3,] 1510 -1 -1 -8 -22 -36 -52 -64 [4,] 162100 -7 -21 -35 -51 -63 [5,] 162100 -7 -21 -35 -51 -63 [6,] 2398770 -14 -28 -44 -56 [7,] 37 23 22 21 21 140 -14 -30 -42 [8,] 51 37 36 35 35 28 140 -16 -28 [9,] 67 53 52 51 51 44 30 160 -12 [10,] 79 65 64 63 63 56 42 28 12 0 averank [1] 15 29 30 31 31 38 52 66 82 94 - Original Message - From: IAIN GALLAGHER [EMAIL PROTECTED] To: Martin Henry H. Stevens [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Monday, October 17, 2005 2:29 PM Subject: Re: [R] Dunn's post hoc test Thanks for your reply Hank. It's not really what I'm after (though it's good to know). For the test ( as described in Statistics for the Biosciences by W. Gardiner. Prentice Hall, 1997) I have to rank my groups, calculate the average rank, then subtratc each average rank from every other. Any value greater than the test statistic is significant. eg average rank difference table: 2 5 89 ---|-- 2 - 3 67 | 5 - - 34 | 8 - - -1 | 9 - - -- | I can't get my head around writing an algorithm for this if I have a vector of average ranks eg averank- c(2,5,8,9). I know I can address the vector by index and that this is probably the correct route but I can't get the indexing algorithm right! I'm sure someone will point out somethng simple and I'll kick myself but the help would be appreciated. Thanks again. Iain Gallagher --- Martin Henry H. Stevens [EMAIL PROTECTED] wrote: I don't know Dunn's rank test, but the following substracts each of the sums of averanks from the next rank. cumsum(averank)[-length(averank)] - averank[-1] Hank On Oct 17, 2005, at 4:30 AM, Iain Gallagher wrote: Hi Everyone. I am rather new to R and I've been trying to implement a function to carry out the above test. For a couple of days now I've been stuck on how to generate average rank differences. Say I have a vector of average ranks: averank- c(2,5,9,12) I would like to subtract averank[1] from averank[2], averank[1] and averank[2] from averank[3] and averank[1], averank[2] and averank[3] from averank[4] etc (I know the syntax is wrong here... it's just for illustration) but I can't work out how to do it. Ideally I would like to generate an array showing the differences between the average ranks so I could tell at a glance which ones were greater than my critical value I've been looking at loops etc but it's a little beyond me at the moment. Thanks for any suggestions. Iain Gallagher IIIR Edinburgh University __ 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 Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ 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] Getting eps into Word documents.
On 03-Oct-05 Marc Schwartz (via MN) wrote: On Mon, 2005-10-03 at 16:31 -0300, Rolf Turner wrote: A student in one of my courses has asked me about getting R graphics output (under Linux) into a Word document. I.e. she wants to do her R thing under Linux, but then do her word processing using Word. --snip-- So use something like the following: postscript(RPlot.eps, height = 4, width = 4, horizontal = FALSE, onefile = FALSE, paper = special) plot(1:5) dev.off() You can then import the .eps file into Word or most other such applications that can import encapsulated postscript files. -snip More information is available from MS here: http://support.microsoft.com/?kbid=290362 HTH, Marc Schwartz --snip--- b) It won't work anyway if printed to a non-PostScript printer. True, which is the case irrespective of Word/Windows. If you don't have a PS printer locally or accessible via network, you can always install a PS printer driver and print to a file, which can then be printed by a third party if required. Well, as a lowly Windows and Office user, I most often right click on R grahics, cut to clipboard, and paste into Word. So one possiblility is for the student to install R on her own machine (Windows or Mac?). But I just tried Marc's suggestion, and it looks VERY VIABLE to me. I generated the graph from his code snippet and used Insert picture from file in Word 2003 to place the graphic in a Word document. I then tried printing on both an HP 4100 TN laserjet and an HP 960c deskjet. The image printed perfectly on both printers with crisp lines and text that apprear to be vector-based not degraded bitmapped representations. Certainly worth the student trying. HTH, Rob Baer __ 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] Problem with tick marks in lines.survfit (package survival)
How about: plot(fit, mark.time=TRUE, xscale=365.24,xlab='Years', ylab='Survival',lwd=c(2,1)) Rob - Original Message - From: Rachel Pearce [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, September 19, 2005 4:59 AM Subject: [R] Problem with tick marks in lines.survfit (package survival) I have attempted to follow posting guidelines but I have failed to find out what I am doing wrong here. I am trying to use lines.survfit to plot a second curve onto a survival curve produced by plot.survfit. In my case this is to be a progression free survival curve superimposed upon an overall survival curve, but I will illustrate my problem using the example given in the help for lines.survfit. I would like to have tick marks for censored data points on both curves, so I would like to do something like: fit - survfit(Surv(time, status) ~ sex, pbc,subset=1:312) plot(fit[2], mark.time=TRUE, xscale=365.24, + xlab='Years', ylab='Survival') lines(fit[1], lwd=2, xscale=365.24, mark.time=TRUE) but when I do this, no tick marks appear on the second curve. Can anyone see what I am doing wrong here? Rachel [[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] The Perils of PowerPoint
The R relevance here might be that all the statistics in the world wrongly applied to data will only bury its information content...R and Powerpoint (and Matlab and Perl and...) are all terrific tools for turning data into knowledge, but tools DO NOT relieve us of the necessity of thinking about and analyzing the meaning of the data with our intellect as well. It is wrong to blame ANY tool for our own shortcomings! My two cents, Rob - Original Message - From: Marc Schwartz [EMAIL PROTECTED] To: R-Help r-help@stat.math.ethz.ch Sent: Friday, September 02, 2005 8:18 AM Subject: [R] The Perils of PowerPoint Hi all, Below is a URL for an editorial published today in our local newspaper, the Minneapolis StarTribune. It was originally published in the Washington Post a couple of days ago: http://www.washingtonpost.com/wp-dyn/content/article/2005/08/29/AR2005082901444.html but that site requires registration. The 'Strib site seems to be open for the moment: http://www.startribune.com/stories/1519/5591930.html I thought folks might find it interesting. Best regards, 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-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