Displaying 20 results from an estimated 10000 matches similar to: "legend(): how to put variable in subscript?"
2003 Nov 11
2
Test for new page
Dear R experts,
I am writing a multi-page PDF file and would like to put a header on each
page. Is there a way to test a graphic device to see if a new page is started
(so that I know when to write the header)?
I could simply count the plots made (each page has the same number of plots),
but wanted to see if a more general solution is available.
Thank you,
Aleksey
--
Aleksey Naumov
GIS
2005 Mar 18
3
plotmath question
R listers:
I have been foiled by plotmath!
(in R 2.01,Windows 2000)
The task: Plot a normal density and label the ticks as mu - 3 sigma, mu - 2
sigma, ...., mu + 3 sigma, where the mu's and sigmas appear as Greek
symbols, of course.
The following code does this:
x<-seq(-3,to=3,by=.01)
y<-dnorm(x)
plot(x,y,type='h',col='lightblue',axes=FALSE)
2003 Jun 22
1
Using weighted.mean() in aggregate()
Dear R users, I have a question on using weighted.mean() while aggregating a
data frame. I have a data frame with columns Sub, Length and Slope:
> x[1:5,]
Sub Length Slope
1 2 351.547 0.0025284969
2 2 343.738 0.0025859390
3 1 696.659 0.0015948968
4 2 5442.338 0.0026132544
5 1 209.483 0.0005304225
and I would like to calculate the weighted.mean of Slope, using Length
2009 Jun 03
1
Would like to add this to example for plotmath. Can you help?
Greetings:
I would like comments on this example and after fixing it up, I need
help from someone who has access to insert this in R's help page for
plotmath.
I uploaded a drawing
http://pj.freefaculty.org/R/Normal-2009.pdf
that is created by the following code
http://pj.freefaculty.org/R/Normal1_2009_plotmathExample.R
This will be a good addition to the plotmath help page/example.
2010 Jul 06
1
plotmath vector problem; full program enclosed
Here's another example of my plotmath whipping boy, the Normal distribution.
A colleague asks for a Normal plotted above a series of axes that
represent various other distributions (T, etc).
I want to use vectors of equations in plotmath to do this, but have
run into trouble. Now I've isolated the problem down to a relatively
small piece of working example code (below). If you would
2009 Aug 12
2
Using bold font with bquote
I'm trying to annotate a density plot and I'm using bquote to paste the sigma symbol next
to the numeric text of the standard deviation calculation that I am performing.
I have been able to successfully turn the sigma symbol and numeric output the color blue,
but when I try to change the font of the text to bold, R doesn't seem to recognize the "font="
command in the same way
2008 Apr 08
2
plotmath "overstrikes" in output on a Linux system
I've been testing plotmath. But I'm getting some funny output one one
computer. The problem is that characters are 'jumbled' and overstrike
when symbols are introduced.
Sample code:
mu <- 440.0
sigma <- 12.5
myx <- seq( mu - 4*sigma, mu+ 4*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
# Here's one way to retrieve the values of mu and sigma and
2008 Apr 02
1
Trouble combining plotmath, bquote, expressions
I'm using R-2.6.2 on Fedora Linux 9.
I've been experimenting with plotmath.
I wish it were easier to combine expressions in plotmath with values
from the R program itself. There are two parameters in the following
example, the mean "mymean" and standard deviation "mystd". I am able
to use bquote to write elements into the graph title like
mu = mymean
and R will
2009 Aug 12
2
Plotting sigma symbol with unicode and turning into pdf
Paul,
You solution worked out really well when I ran my code in R. However, when I try to turn the plot into a pdf, the unicode string no longer seems to function and instead of the sigma symbol there are just two periods (See example code below).
The following is the code working in the R environment just like I want it to look:
set.seed(1)
Data=rnorm(100,sd=10000)
plot(density(Data))
2006 Aug 24
2
help with pasting + expressions?
I can't believe I'm having such a hard time with this and I haven't been
able to find out how to solve this...
lab <- expression( paste( hat(v),
as.character(round(y.hat,2)), ",",
hat(sigma)^2, as.character(sigma.hat)) )
text( x=pt$x+2, y=pt$y,labels=lab )
## the text should be \hat{y} = <value of y.hat>, \hat{\sigma}^2 == <value
of sigma.hat>
and R
2012 Jul 21
2
two questions re: the use of lattice
Dear friends,
I have two questions regarding the use of lattice. First some code:
## begin code
z <- cbind(rep(c("BIC", "ICL", "s_v", "Q_v", "sig-q",
"s_lsk", "s_lML", "s_mlsk", "s_mlML", "s_la8",
"s_haar"), each = 250), rep(c(5, 10, 20, 30, 50), each = 50))
z
2010 Nov 16
4
Simple error handling in R
Hi R experts,
I am looking for a simple error handling approach, whereby I could stop
function execution with a customized error message. For example:
for (i in 1:10) {
if (i == 5)
# I'd like to be able to stop right here with an error message I have
complete control over
}
The problem with stop() is that I cannot control completely what gets
printed to the terminal, even with
2000 Mar 26
2
hist2d() function in R?
Dear R users,
I am just starting with R (v. 1.0.0) and I use Vehables & Ripley's
MASS book for examples.
In the intro session, there is an example of a 2D histogram on an 8x8
grid:
x <- rnorm(1000)
y <- rnorm(1000)
contour(hist2d(x,y,,,8,8))
R complains:
Error in contour(hist2d(x, y, , , 8, 8)) :
couldn't find function "hist2d"
I looked for hist2d() in the
2010 Jun 05
2
Greek letters and formatted text
Hi,
I desperately try to do s.th. like
m=1.23455
sig=0.84321
plot(1,1)
text(0.8,1,sprintf("<Sigma>=%1.2f?%1.2f",m,sig))
where actually the greek letter should appear for Sigma.
I have tried all sorts of combinations with expression and paste etc. but could not work it out. Maybe someone has an idea and can help me.
Thanks a lot+
Thomas
2002 Oct 26
3
Using the Search Engine & Keywords
Dear R experts,
Can anyone running R on Linux share how they use the "Search Engine &
Keywords" page of R documentation? I cannot do any javascript on this page,
either searching for a term or following the keyword links. I tried Konqueror
(3.0.4, with javascript globally enabled), Mozilla (1.1), and Galeon (1.2.5),
but none of them do anything...
Sorry, I don't know
2010 Mar 09
3
Shade area under curve
I want to shade the area under the curve of the standard normal density.
Specifically color to the left of -2 and on. How might i go about doing
this?
Thanks
--
View this message in context: http://n4.nabble.com/Shade-area-under-curve-tp1586439p1586439.html
Sent from the R help mailing list archive at Nabble.com.
2000 Nov 17
2
Randomly selecting n (unique) elements out of vector of length m...
Dear R users,
I wonder if there is a simple way to select a random and non-overlapping
subset of a vector?
Say, I need to randomly select 10 out of 100 numbers in a vector V. By
"non-overlapping" I
mean that a number in any position in V (V[1]...V[100]) should be
selected at most once
(i.e. selection without recycling).
I could simplu use a uniform distribution to generate selection
2000 Oct 10
1
Adding a new column to data frame (recoding)
Dear R users,
I have a very simple question. What is the easiest way to recode data in
one
of the columns of a data frame and put it into a new column?
For example, here is a simple data frame:
var1
1 1
2 2
3 3
How do I add a new column to data - 'var2' in which I group values in
'var1',
for example:
var1 var2
1 1 4
2 2 4
3 3 5
It's got to
2009 Aug 11
1
Paste symbol and calculation in plot
I'm trying to annotate a density plot and I would like to have R calculate the
standard deviation and place it in the plot next to the standard deviation symbol
"sigma". I can successfully use the text command to paste "StDev =",round(sd(Data),digits=3))
on the plot. However, I have trouble when I want to replace "StDev" with the Greek
symbol sigma (See code
2008 Dec 31
3
Plotmath with values?
I hope to use the plotmath facility to print titles that mix
math and values of R variables.
The help for "plotmath" has an example, which after repeated
reading, I find baffling. Likewise, I have read the help file
for "substitute" (wqhich seems to be needed) without ever
understanding what it does, other than being used in some magic
incantations.
I would like to do