Re: [R] outputing text colors
Another possibility (depending on what you want to do/preferences) is to create a text file that can be postprocessed to give the colors. One example of this is the etxtStart and related functions in the TeachingDemos package. These produce a text file with extra notations that when processed with the enscript program includes different text colors. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of rtist Sent: Thursday, March 18, 2010 7:37 PM To: r-help@r-project.org Subject: [R] outputing text colors Hi all, I was wondering if there is a way to output text tables with the color of the text corresponding to a condition. More specifically, Im outputting an time series table and want the console colors to be green0 and red0. This is very easy to do in excel using conditional formatting. Any ideas on how to do it here? thanks. P.S. I've thought about using a heatmap, but it might be complicated using an ts series object. -- View this message in context: http://n4.nabble.com/outputing-text- colors-tp1598874p1598874.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] outputing text colors
On 03/19/2010 12:37 PM, rtist wrote: Hi all, I was wondering if there is a way to output text tables with the color of the text corresponding to a condition. More specifically, Im outputting an time series table and want the console colors to be green0 and red0. This is very easy to do in excel using conditional formatting. Any ideas on how to do it here? Hi rtist, If you want the whole table to be displayed in a color, you could do something like: par(fg=ifelse(something 0,green,red)) before you display the table. I am assuming that you want this on a graphics device, not the console in which R is running. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] outputing text colors
Hi Everyone, And thanks for the replies. I was more specifically referring to the console table output itself. I have a time series that has columns of months and rows of years, and each row,col is a value. I wanted the actual text output value to the console table r,c to have a color corresponding to the value, like ifelse(val0,txt=red,txt=green), so that I can quickly have an overview of returns by color. It looks like the only solution is to use a literal graphics object, and that the above solution is not feasible. I'll look into the graphical type objects. It would be nice to have a function that simply reads a time series object table-f(ts.table) and outputs the above criteria. Thanks again. -- View this message in context: http://n4.nabble.com/outputing-text-colors-tp1598874p1599021.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] outputing text colors
On Thu, Mar 18, 2010 at 11:27:40PM -0800, rtist wrote: Hi Everyone, And thanks for the replies. I was more specifically referring to the console table output itself. I have a time series that has columns of months and rows of years, and each row,col is a value. I wanted the actual text output value to the console table r,c to have a color corresponding to the value, like ifelse(val0,txt=red,txt=green), so that I can quickly have an overview of returns by color. It looks like the only solution is to use a literal graphics object, and that the above solution is not feasible. I'll look into the graphical type objects. It would be nice to have a function that simply reads a time series object table-f(ts.table) and outputs the above criteria. It's possible to do it (at least in a Linux terminal emulator) with the package xterm256. However, the default print function does not print the scape sequences which the terminal emulator interprets as colors. It would be necessary to create a print method for ts.table (or any other object to be printed in color). Simple example: library(xterm256) x - style(c(-1, 0, 1), fg = c(red, blue, green), check.xterm = F) cat(x, \n) print(x) -- Jakson A. Aquino Federal Uni. of Ceara www.lepem.ufc.br - Brazil __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] outputing text colors
Hi all, I was wondering if there is a way to output text tables with the color of the text corresponding to a condition. More specifically, Im outputting an time series table and want the console colors to be green0 and red0. This is very easy to do in excel using conditional formatting. Any ideas on how to do it here? thanks. P.S. I've thought about using a heatmap, but it might be complicated using an ts series object. -- View this message in context: http://n4.nabble.com/outputing-text-colors-tp1598874p1598874.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] outputing text colors
Tena koe Perhaps the thread started earlier this week ([R] How good is R at making publication quality tables?) would help you. HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of rtist Sent: Friday, 19 March 2010 2:37 p.m. To: r-help@r-project.org Subject: [R] outputing text colors Hi all, I was wondering if there is a way to output text tables with the color of the text corresponding to a condition. More specifically, Im outputting an time series table and want the console colors to be green0 and red0. This is very easy to do in excel using conditional formatting. Any ideas on how to do it here? thanks. P.S. I've thought about using a heatmap, but it might be complicated using an ts series object. -- View this message in context: http://n4.nabble.com/outputing-text- colors-tp1598874p1598874.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.