Displaying 20 results from an estimated 10000 matches similar to: "expression() help"
2010 Mar 18
2
greek symbols on ylab=
Hi All,
I'm trying to get following but not successfully:
# this works okay
ylab=expression("PM2.5 Concentration ("*mu*g/m^3*")")
# But I need "2.5" as a subscript to PM and below this an additional line
saying some text, like.
ylab=expression("PM[2.5] Concentration ("*mu*g/m^3*")"\n(random text in
brackets))
Square brackets doesn't
2009 Dec 02
1
Fw: Re: Help: barchart() {Lattice}
I HAVE BEEN ASKED TO BE REMOVED FROM THIS LIST OVER 20 TIMES, PLEASE CAN I BE REMOVED!!!!!!!!!!!!!
--- On Thu, 3/12/09, Peng Cai <pengcaimaillist@gmail.com> wrote:
From: Peng Cai <pengcaimaillist@gmail.com>
Subject: Re: [R] Help: barchart() {Lattice}
To: "Felix Andrews" <felix@nfrac.org>
Cc: r-help@r-project.org
Received: Thursday, 3 December, 2009, 10:17 AM
Got it
2009 Dec 09
1
Greek symbols on "ylab=" using barchart() {Lattice}
Hi All,
I'm trying to write "ug/m3" as y-label, with greek letter "mu" replacing "u"
AND "3" going as a power.
These commands works in general:
plot.new()
text(0.5, 0.5, expression(symbol("m")))
But, I'm sure about how to do it using barchart() from "Lattice". Can anyone
help please?
Thanks,
Peng Cai
[[alternative HTML
2009 Dec 03
4
Two-way/Three-way sum.
Hi R Users,
I'm wondering how can I calculate two (or three) way sum of a variable. A
sample data is:
State Month Year Value
NC Jan 1996 1
NC Jan 1996 2
NC Feb 1997 2
NC Feb 1997 3
NC Mar 1998 3
NC Mar 1998 4
NY Jan 1996 4
NY Jan 1996 5
NY Feb 1997 5
NY Feb 1997 6
NY Mar 1998 6
NY Mar 1998 7
I'm trying to sum up "value" column by State*Month and by State*Month*Year.
Also, I
2009 Nov 26
1
{ggplot2} Adding Mean to (grouped) Boxplot.
Hi R Users,
I am using following R code to plot a "grouped boxplot". I'm hoping if I can
add MEAN to these boxplots. Data is copied below and attached as text file.
install.packages("ggplot2")
library(ggplot2)
dta<-read.table("Sample.txt",header=T)
attach(dta)
p <- ggplot(dta, aes(factor(month), nail))
p + geom_boxplot(aes(fill = factor(trt)))
Data:
month
2009 Nov 26
3
barchart() {Lattice} help.
Hi R Users,
I'm trying to plot a stacked barplot. Here is data:
Sample Col1 Col2 Col3
Row1 -2 4 -1
Row2 3 -2 4
Row3 3 5 -2
Row4 4 1 -1
I'm using following R code:
library(lattice)
dta<-read.table("data.txt", header=TRUE, row.names="Sample")
barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
col=2:4,
2009 Dec 02
2
Help: barchart() {Lattice}
Hi R Users,
I'm using following data/code (data is attached also) to produce a stacked
barplot.
# Sample Data:
Names Col1 Col2 Col3
Row1 -20 40 -10
Row2 30 -20 40
Row3 30 10 -20
Row4 20 20 -10
# R Code:
dta<-read.table("data.txt", header=TRUE, row.names="Names")
barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
par.settings = simpleTheme(col =
2010 Feb 26
1
bwplot() {lattice}
Hi All,
I'm trying to plot boxplot graph. I tried barchart with "groups=" option and
it worked fine. But when I try to generate same kind of graph using
bwplot(), "groups=" option doesn't seem to work. Though this works,
yield ~ variety | site * year
I'm thinking why "groups=" doesn't work in this case, can anyone help
please...
#Code:
2004 Nov 11
5
expressions and paste
I have written a function to plot data which will be used for various different chemistries.
A simplified version is:
plot_data <- function(risk,levels,chem,sd2,measure){
plot(risk, levels,main=paste ("per", sd2, measure, "\n in usual", chem))
}
The problem is with the title.
This works fine if the variable "chem" is just text, but if it is an expression then
2010 Mar 17
2
Adding text outside (lattice barchart) plotting region.
Hi All,
I need some help with adding text at the bottom of the graph (outside of
default outline of graph).
Say, I need to write "Month: 01 04" below each of the two years in the
following R code, something like this:
_______________
| |
| Plot |
|___ __________|
1931 1932
2006 Oct 24
2
Plotmath expression
Hello,
I've been trying to plot a subscript in a text formula using plotmath but I
haven't been able to do so.
In my example below I would like the text label to show
X[min] = 10.1 +/- 5.5
Here is the code:
ll <- c(x=10.1, sde=5.5)
plot(1:10)
text(x=9, y=2, pos=2, expression(paste(X[min], "=", paste(ll,
collapse="+/-"))))
This works fine up to the inner paste
2009 Dec 19
2
Lattice boxplots
Hi All,
I'm familiar with bwplot() in lattice package. Is it possible to get such a
boxplot using lattice package:
http://www.reading.ac.uk/ssc/publications/graphics/mma-fig1.gif
instead of the following default:
http://media.wiley.com/wires/WICS/WICS22/mfig005.gif
My aim is to get a compact boxplot for publication. Having legend can help
because otherwise x-axis labels are repeated for
2009 Dec 02
1
barchart() {Lattice} -- auto.key()
Hi R Users,
I'm using following data/code (data is also attached) to produce a stacked
barplot.
*I need help with changing legend boxes, currently I'm using
"rectangles=TRUE". Is it possible to get small squares instead -- may be
with a small gap between colored squares.* Currently there is no gap between
the colored rectangles.
# Sample Data:
Names Col1 Col2 Col3
Row1 -20 40
2009 Sep 17
3
How to generate a matrix where each row (or column) is the same vector?
Hi,
I can use the following code to generate a matrix, each column of
which is 'x'. But I have to specify '5' twice in the second command. I
am wondering if there is a better way to do it.
> x=1:10
> matrix(rep(x,5),nc=5)
> t(matrix(rep(x,5),nc=5))
Regards,
Peng
2009 Oct 12
2
mkdir in R?
Hi,
Besides calling shell command mkdir by system(), I'm wondering if
there is a buildin command in R to make a new directory.
Regards,
Peng
2009 Sep 28
1
axis label using expression()
Probably a very simple problem:
I want to annotate a plot axis with a name of my data using
expression().
The name for the data is $\hat P4_k$ written in LaTex style -> hat
symbol above P, followed by a 4 and a subscripted k index
I tried to write this using
x<-c(1,2,3,4)
y<-c(3,5,7,9)
plot(x,y,xlab=expression(hat(P4[k])) )
but cant find a way to force the hat
2009 Sep 17
2
What is the time complexity of 'match()'?
Hi,
Suppose 'x' is a vector of length n and 'y' is a vector of length m, I
am wondering what the time complexity of 'match(x,y)' is. Is it n
times m?
Regards,
Peng
2013 Jul 01
1
Male and female signs as subscript in plot
Hello,
I'd like to add labels to my plot that include a male or female symbol as
subscript.
I'm working in Windows Vista and R 3.0.0.
I am able to add the male symbol to the plot as regular text (NOT as
subscript), e.g. with:
mtext("Male\u2642")
This displays the word "Male" followed by the male symbol on the plot.
But "\u2642" does not work when I try to
2009 Sep 16
1
How to convert a frame to a matrix while maintaining that a number is still a number?
Hi,
See the code below.
'x' is a frame. x$C1 are all numbers 1, 2 and 3.
'as.matrix(x)' convert x$C1 to strings "1", "2" and "3". I'm wondering
how to maintain that the first column of 'as.matrix(x)' still numbers.
Regards,
Peng
$ cat read.csv
"C1","C2"
"1","x"
"2","y"
2005 Jul 19
3
R: expression
hi all
i am having a problem with the expression/paste command
say we estimate a variable, named PHI
it contains the value of say 2
and we want to display this value as " hat(phi) = PHI" onto a graphic
i.e. " hat(phi)=2 "
how does one do this?
i've tried the following:
1. legend(-5,.3,expression(hat(phi)*"="*PHI))
2.