Displaying 20 results from an estimated 10000 matches similar to: "R equiv of #ifdef?"
1997 Sep 25
2
R-beta: return()
I have a question on the use of return(). (Nothing on it in the docs I
have)
The test code below gives the error: Error: Object "x" not found
when I do: thingy2().
How should it be fixed? Thanks very much for any help!
(My original solution to this sort of problem was to use global variables
x<<-...
y<<-...)
Bill Simpson
-----------------------------
thingy<-function(k)
2001 Mar 07
4
R.xpm?
I use AfterStep on Linux. I made an R.xpm file (attached)
and put this icon in the "wharf". To invoke R I click on the R icon.
I did not find an offical R.xpm, and so I am submitting this one
for your collective consideration....
The idea behind the icon is that it looks like a scatterplot, which is
"statistical". My main beefs with my R.xpm are that it doesn't have a
2000 Oct 17
1
filed plot symbols
This example,
x<-1:10
y1<-x
y2<-x+2
plot(x,y1,pch=21,ylim=range(c(y1,y2)),type="o",lty="solid",bg="white")
points(x,y2,pch=22,type="o",lty="dashed",bg="white")
legend(7,3,legend=c("y1","y2"),pch=c(21,22),lty=c("solid","dashed"),bg="white")
works if I use pch = one of 21-25. But
1999 Jun 10
2
limit digits in text()?
I am labelling the axes of a persp() plot manually using text(). For
one spot in the plot I use:
text(-.62,.37,max(dprime))
The problem is that the label is printed as 1.6456330961.
I would like 1.6.
I tried options(digits=2) and str(digits.d=2)--no effect. (I don't like
these methods anyway since I just want to modify how the label in the plot
is printed; I want to print all the digits
1998 Sep 03
2
ppoints
When I look at ppoints I see:
ppoints<-function (x)
{
n <- length(x)
if (n == 1)
n <- x
(1:n - 0.5)/n
}
However Venables & Ripley (2nd ed, p 165) say ppoints() should return
(i-1/2)/n for n>=11; (i-3/8)/(n+1/4) for n<=10.
The version below should work as described:
ppoints<-function (x)
{
n <- length(x)
if (n <= 10)
(1:n - 0.375)/(n + 0.25)
else
(1:n - 0.5)/n
2001 Mar 28
5
R and xterm
Howdy!
I have a problem that's similar to one discussed earlier on the list:
When not in xterm all the backspace and cursor-movements and stuff
are working well. Only when I start R in an xterm window backspace
appears as ^H and so on. What can I do?
Ragnar
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2001 Mar 20
5
animation?
I was wondering if anyone out there has created a series of images (e.g.
jpegs) using R, then animated them on a web page. I have looked around a
bit and it seems fairly complicated. One approach that seems sensible is
to use a java script that displays the list of images. I have only used
html on web pages before so I don't know how to use java...
Ideally the final result is easily ported to
2000 Mar 21
5
par help wrong: xlog & ylog (PR#497)
Full_Name:
Version: 1.0.0
OS: linux
Submission from: (NULL) (193.62.250.209)
?par lists and describes xlog and ylog, though these are obsolete. It does not
list
log. I found out about log from ?plot.defaults--so that help is OK.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send
1999 Dec 13
1
pointsize?
A while ago there was a thread on graphics. I complained that the plots
produced by dev.print had symbols and fonts that were too small. I said
I had been using par(cex=2), but the advice was to use pointsize. I have
tried ps, is that what was meant?
par(ps=40)
x<-rnorm(100)
y<-rnorm(100)
dev.print(file="~/junk.ps", horizontal=FALSE)
No matter how big I make ps (40,60...), the
1998 Jan 07
1
R-beta: image
Questions on image:
1) How can I put labels on the x and y axes?
2) How to tell it to use e.g. 32 grey levels (not some colour map)?
3) How to know what the legend is (i.e. each grey level = what z value)?
Thanks very much for any help.
BTW I was wondering if persp was on the To Do list. That would be great!
Bill Simpson
2000 Oct 09
4
lm question
I have not really used lm before and I was hoping for some help on a
simple problem.
Here is a toy version of the problem I want to solve.
y x grp
-.9 1 a
-.8 2 a
-.7 3 a
-.7 1.5 b
-.5 2.5 b
-.3 3.5 b
-.19 2.7 c
-.11 3.7 c
-.41 4.7 c
I want to fit a model that has one y-intercept and three slopes, one for
1998 Feb 26
3
R-beta: quantile
I do:
x<-rnorm(1000)
quantile(x,c(.025,.975))
2% 98%
-1.844753 1.931762
Since I want to find a 95% confidence interval, I take the .025 and .975
quantiles. HOWEVER R says I have the 2% (not 2.5%) and 98% (not 97.5%)
points. Is it just rounding the printed 2% and 98%, or is it REALLY
finding .02 and .98 points instead of .025 and .975?
Thanks for any help.
Bill Simpson
1998 Feb 26
3
R-beta: quantile
I do:
x<-rnorm(1000)
quantile(x,c(.025,.975))
2% 98%
-1.844753 1.931762
Since I want to find a 95% confidence interval, I take the .025 and .975
quantiles. HOWEVER R says I have the 2% (not 2.5%) and 98% (not 97.5%)
points. Is it just rounding the printed 2% and 98%, or is it REALLY
finding .02 and .98 points instead of .025 and .975?
Thanks for any help.
Bill Simpson
2000 Nov 17
2
hist() and density
There were some questions about hist() a couple of days ago which
triggered this post. My question/suggestion is about the y-axis in hist.
There are reasons to prefer making the y-axis density=relative
frequency/bin width. One reason is that the height of the plot does not
depend on the bin width; another is that if your histogram is in density
then you can easily superimpose a smooth theoretical
2002 Apr 15
3
Greek in text()
I have gone over the examples and can't figure this out:
rho<-.77
text(x=.05,y=.5,paste(expression(rho),rho))
I was hoping to get this to print a Greek rho with 0.77 beside it.
Instead I get: rho 0.77 (i.e. Roman lettering)
The help on expression() is quite opaque so I don't understand how it
works.
Thanks for any help.
Bill Simpson
1998 Apr 03
1
R-beta: default paper size
After some paper clipping problems I checked options() and saw that the
default paper size was a4; I need US Letter. So as per instructions I
uncommented the R_PAPERSIZE line in config.site,
R_PAPERSIZE=letter
Restarting R, everything is still the same though. I guess I have to
reinstall?
That seems awkward. Is there a way a prompt ("a4 or letter paper?") can
be inserted in the
1999 May 11
1
dev.print help page (PR#191)
Full_Name: Bill Simpson
Version: 0.64.1
OS: linux
Submission from: (NULL) (193.62.250.209)
Two problems with dev.print help.
1. Under Examples:
dev.print(width=6, height=6, horizontal=F)
^ FALSE
2. dev.print help does not describe any of its parameters (e.g. height or
width).
Not described on the other dev.xxx pages either
2002 Apr 15
1
vector average
I have some x,y data like this:
> Age
[1] 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 13 13 13 13 13 14
14 14
[26] 14 14 20 20 24 24 24 24 25 25 26 26 26 26 26 26 27 27 27 27 28 28 28
31 31
[51] 33 33 33 33 42 42
> Eff
[1] 0.0020974230 0.0027592200 0.0005083383 0.0032771380 0.0103963000
[6] 0.0001853803 0.0003308799 0.0013806050 0.0011010700 0.0004344708
[11] 0.0004218284
2001 Feb 20
4
wait for user input
I want to display a series of plots:
display plot 1
wait for user input (keypress or mouse click)
display plot 2
etc
How to do it? Thanks for any help.
(I have been using locator().)
Bill Simpson
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or
2001 Oct 02
4
plot of Bernoulli data
I have some Bernoulli data something like this:
x<-sort(runif(100,1,20))
p<-pnorm(x,10,3)
y<-as.numeric(runif(x)<p)
plot(x,y)
lines(x,p)
This plot is not very satisfactory because the ogive does not visually
fit the (0,1) points very well, and also because the points tend to fall
on top of one another. The second problem can be eliminated by adding
vertical jitter. However I was