plot(0, xlab=bquote(theta * = * .(x)))
?substitute
?bquote
HTH,
baptiste
2009/9/21 Jarrod Hadfield j.hadfi...@ed.ac.uk:
Hi,
I want to have a legend that is a mixture of numbers and symbols, and have
found no way of achieving this.
For example, if I want theta=x or theta=2 this is easily
Dear list,
I think I'm being dense, but I can't get combn or expand.grid to give
me this result. I need to generate a matrix of all 16 possible
sequences of 4 boolean elements,
0001
0010
0011
0100
.
(in the end I'll have to assign NA to the 0s and some value to the 1s
but let's
I knew I was missing the obvious. And to think it's only Monday...
Thanks everyone!
baptiste
2009/9/21 Henrique Dallazuanna www...@gmail.com:
Try this:
do.call(expand.grid, rep(list(0:1), 4))
On Mon, Sep 21, 2009 at 2:04 PM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Dear list
Hi,
Not exactly answering your question, but latticeExtra provides a
function useOuterStrips that you could use to have a single S11 strip
on the left instead.
HTH,
baptiste
2009/9/20 di jianing jianin...@gmail.com:
Hello R helpers,
I am producing a figure with dual strips, i.e., x~y | S1
Hi,
From what I understand, I would suggest the following strategy,
1- combine all data in a single data.frame (see merge, rbind, reshape
package, etc.)
2- plot all data at once using a formula like this,
boxplot(d~f,data=df)
HTH,
baptiste
2009/9/20 Sam Player samtpla...@gmail.com:
# I
Dear all,
I'm trying to follow an old document to use Grid frames,
Creating Tables of Text Using grid
Paul Murrell
July 9, 2003
As a minimal example, I wrote this,
gf - grid.frame(layout = grid.layout(1, 1), draw = TRUE)
label1 - textGrob(test, x = 0, just = left, name=test)
it might be possible to set up a particular mode before copying the history,
### start example ###
email = function(op){
if(!missing(op)) {
options(op) } else {
op - options()
options(prompt = )
options(continue = )
op
}
}
op = email()
a = 1:10
a
email(op)
a = 1:10
a
### end
Dear list,
As a minimal test of a more complex grid layout, I'm trying to find a
clean and efficient way to arrange text grobs in a rectangular layout.
The labels may be expressions, or text with a fontsize different of
the default, which means that the cell sizes should probably be
calculated
Neat!
What if, instead, one wanted to format his/her code in the console
before sending it by email? Any tips for that?
(I proposed something like options(prompt= ) above, but got stuck
with adding a comment # to printed results)
Thanks,
baptiste
2009/9/19 Gabor Grothendieck
A few amendments might make this improved code more readable,
e = expression(alpha,testing very large width, hat(beta),
integral(f(x)*dx, a, b))
library(grid)
rowMax.units - function(u, nrow){ # rowMax with a fake matrix of units
matrix.indices - matrix(seq_along(u), nrow=nrow)
Hi,
What about this,
eval(parse(text=expr))
(no print)
HTH,
baptiste
2009/9/19 Nick Matzke mat...@berkeley.edu:
Hi,
I have a script which I source, which evaluates a changing expression call
hundreds of times. It works, but it prints to screen each time, which is
annoying. There must
I don't understand your question.
Where does your data come from in the first place? Is it stored in a
file, or is it a result of a previous operation in R, or is it
something you need to copy and paste in your script, or ...?
the textConnection() construct is often used to make for
No box is easy,
bwplot(y~x, data=data.frame(y=rnorm(10),x=sample(letters[1:3],10,repl=T)),
par.settings=list(axis.line=list(col=NA)))
but that seems to remove all axis lines and ticks as well. You may
have to define a custom panel.axis() function.
An alternative is to use grid.remove() to
Hi,
for basic tables (e.g. display a data.frame without fancy formatting),
you could try the textplot() function from the gplots package, or this
rough function for Grid graphics,
source(http://gridextra.googlecode.com/svn/trunk/R/tableGrob.r;)
# install.packages(gridextra,
Try this,
sapply(Mabslim , my_gamma, alpha=-1, xstar = -21, xmax = -27)
or wrap it with ?Vectorize,
vmy_gamma = Vectorize(my_gamma, vectorize.args = xlim)
vmy_gamma(alpha=-1, xstar = -21, xlim= Mabslim, xmax = -27)
HTH,
baptiste
2009/9/17 Maurizio Paolillo paoli...@na.infn.it:
Dear R
Try this,
marco2 = matrix(rnorm(4), nrow=2, ncol=2)
marco3 = 2.12
i =1
plot.new()
mtext(bquote(R^2*.(round(marco2[1,i],digits=3))* N° of
proteins:*.(marco3[i])),side=4,cex=.6)
HTH,
baptiste
2009/9/16 Marco Chiapello marpe...@gmail.com
/Dear all,///
/I am very thankful, if you could tell
?Reduce
maybe
HTH,
baptiste
2009/9/16 OKB (not okblacke) brenb...@brenbarn.net
Is there anything like cumsum and cumprod but which allows you to
apply an arbitrary function instead of sum and product? In other words,
I want a function cumfunc(x, f) that returns a vector, so that
Hi,
It's probably easiest with the pdf (or postscript) device,
pdf(all.pdf)
for(ii in 1:27)
plot(rnorm(10), main=paste(plot, ii))
dev.off()
Bitmap-based devices can generate sequential filenames (Rplot1.png,
Rplot2.png, ...) that you could combine in a single document using external
tools
Hi,
Using ggplot2, you could do something like this,
library(ggplot2)
myplot - function(x, y, data, geom=point){
ggplot(data=data, map=aes_string(x=x, y=y, colour = treatment) ) +
layer(geom=geom) +
scale_colour_manual(values=c(red, blue))
}
d = data.frame(Xmeas=rnorm(10), Ymeas=rnorm(10),
Hi,
try this,
rowMeans(as.data.frame(Coefs))
# or apply(as.data.frame(Coefs), 1, mean)
HTH,
baptiste
2009/9/14 Masca, N. nm...@leicester.ac.uk
Dear All,
I have a problem which *should* be pretty straightforward to resolve - but
I can't work out how!
I have a list of 3 coefficient
Hi,
tail(x,2)
or
x[seq(nrow(x)-1, nrow(x)), ]
HTH,
baptiste
2009/9/14 Peng Yu pengyu...@gmail.com
Hi,
x=matrix(1:60,nr=6)
I can refer the last 2 rows by
x[5:6,]
If I don't know the total number of rows is 6, is there a way to refer
the last 2 rows?
Regards,
Peng
alternatively, use aes_string,
p - ggplot(bmm, aes_string(x=age, y=bm, colour=pp, group=pp))
p - p + geom_line()
p
HTH,
baptiste
2009/9/14 smu m...@z107.de
hey,
On Mon, Sep 14, 2009 at 07:51:42AM -0700, John Kane wrote:
p - ggplot(bmm, aes(x=age, y=bm, colour=pp, group=pp))
p - p +
Of course if w9zd9_1, w9zd9_2, w9zd9_3 were elements of a data.frame (or
even a list), you could use indexing,
w9zd9 = data.frame(w9zd9_1 = 1:10, w9zd9_2 = 1:10, w9zd9_3 = -2*1:10)
average = function(numbers=1, w9zd9){
if(numbers == 1L) return(w9zd9[ ,1]) # vector case fails with rowMeans
Hi,
See if this helps,
polygon.regular - # return a matrix of xy coordinates for a regular
polygon centered about (0,0)
function (sides = 5)
{
n - sides
if (n 3)
n - 3
if (n 8)
n - 50
th - pi * 2/n
costh - cos(th)
sinth - sin(th)
xx
Hi,
Try this,
myFUN - function(FUN) {
return(deparse(substitute(FUN)))
}
HTH,
baptiste
2009/9/7 Rainer M Krug r.m.k...@gmail.com
Hi
I have the following function which should return the name of FUN:
myFUN - function(FUN) {
return( THE_NAME_OF_FUN(FUN))
}
Is it possible? What do I
Hi,
It's not enough to create a string with your instructions, it also needs to
be evaluated as such.
If you really wanted to evaluate your string, you'd need something like,
a - b - cc - 1 # dummy example
eval(parse(text = cbind(a, b, cc)))
#library(fortunes)
#fortune(parse)
but
Hi,
Something like this perhaps,
p - xyplot(y ~ x | names,
layout = c(1, 3),
panel = function(...,type=p) {
if (panel.number() == 1) {
panel.xyplot(...,type = h)
} else {
panel.xyplot(...,type = type)
}
})
plot(p)
HTH,
baptiste
Hi,
you have two problems in your first scenario,
1- Wrong operator precedence. For example,
1 == 2 | 3
[1] TRUE
where 1==2 is tested as FALSE, but 1 is not tested against 3 for equality as
it would be using,
1 == 2 | 1 == 3
[1] FALSE
or using %in% 2:3
Instead, R evaluates FALSE | 3, and
Hi,
This may come close to what you want,
x - data.frame(ID=rep(letters[1:5],2), A1=rep(10:14,2), A2=rep(2:6,2),
A3=c(101:105,95:99), A4=c(-60, rep(c(0, 3), length=9)))
# basic conditions
cond1 - quote(ID == a A2 1)
cond2 - quote(A1 10)
cond3 - quote(A1 == 10) # note the
it's documented as unexpected
?diag
Note
Using diag(x) can have unexpected effects if x is a vector that could be of
length one. Use diag(x, nrow = length(x)) for consistent behaviour.
And the result follows from this part,
else if (length(x) == 1L nargs() == 1L) {
n -
Hi,
I think you've got a problem with environments,
testA-function(input=1)
{
dat - data.frame(A=seq(input,5), B=seq(6,10))
vec.names- c(a, b)
env - new.env()
for(i in 1:ncol(dat))
{
tab- dat[,i]-1
assign(vec.names[i], tab, env=env)
}
Hi,
Try this,
x = 10
noquote(dQuote(x))
noquote(sQuote(x))
HTH,
baptiste
2009/9/4 sailu Yellaboina bio.sa...@gmail.com
I want to print a variable with in double quotes.
For example
x = 10 ;
x ;#prints 10
x ; #prints x
\x\ ; # Error: unexpected input in \
I want to the out
Hi,
Try this,
library(grid)
value - c(0.1)
lab - c(test,
expression(bquote(paste(.(value[1]*100), and percentiles1,
sep=))),
bquote(expression(.(value[1]*100)* and percentiles2)),
bquote(paste(.(value[1]*100), and percentiles3, sep=)) )
grid.newpage()
Hi,
Try this,
myplot - function(subject) { plot(subject,
main=deparse(substitute(subject))) }
s1 - c(200,200,190,180)
myplot(s1)
see ?deparse
HTH,
baptiste
2009/9/2 Marianne Promberger mprom...@psych.upenn.edu
Dear list,
I've written a function that plots subjects. Something like:
way to bullet proof the code: use as.expression when building lab
Thanks
baptiste auguie wrote:
Hi,
Try this,
library(grid)
value - c(0.1)
lab - c(test,
expression(bquote(paste(.(value[1]*100), and percentiles1,
sep=))),
bquote(expression(.(value[1]*100
2009/8/31 David Scott d.sc...@auckland.ac.nz
I think this discussion is valuable, and have previously asked about style
which I think is very important. Base R does suffer from very inconsistent
naming and as I think Duncan said it makes it very difficult sometimes to
remember names when
Murdoch murd...@stats.uwo.ca
baptiste auguie wrote:
2009/8/31 David Scott d.sc...@auckland.ac.nz
I think this discussion is valuable, and have previously asked about
style
which I think is very important. Base R does suffer from very
inconsistent
naming and as I think Duncan said
Hi,
I think you want %in% instead of ==
see ?%in%
HTH,
baptiste
2009/8/31 AllenL allen.laroc...@gmail.com
Dear R-list,
Seems simple but have tried multiple approaches, no luck.
I have a list of column names:
Hi,
Have you checked that you have the latest version of ggplot2 and plyr?
Please post your sessionInfo()
HTH,
baptiste
2009/8/28 romunov romu...@gmail.com
Dear R-Help subsribers,
upon running into a wonderful ggplot2 package by accident, I abruptly
encountered another problem. Almost
That's right, however the bquote construct may be useful when
combining several conditions,
subset(foo, eval(bquote(.(mycond) a 5)) )
baptiste
2009/8/22 Vitalie S. vitosm...@rambler.ru:
On Fri, 21 Aug 2009 22:38:09 +0200, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Try
Try this,
mat - replicate(4, matrix(rnorm(25), 5), simpl=F)
mat
vect - rnorm(4)
mapply( `*` , mat, vect, SIMPLIFY=F)
HTH,
baptiste
PS: I see someone replied already, but you might find replicate useful too
2009/8/21 RON70 ron_michae...@yahoo.com:
Suppose I have following list :
mat -
Hi,
Say you have the following data and functions that you want to reuse,
d = data.frame(1:10)
foo = function(x,y , ...){
plot(x,y, type=l, ...)
}
You may save the code in a file testing.r, noting that in general
data may find a convenient storage format using save(d, file=
geom_path in ggplot2 is another option, see two examples on this page:
http://had.co.nz/ggplot2/geom_path.html
HTH,
baptiste
2009/8/21 Jim Lemon j...@bitwrit.com.au:
Gonçalo Graça wrote:
Hi! I'm not experienced very experienced with R and i'm looking for a way
doing plots like in this
Try this,
mystr -c==1
subset(foo, eval(parse(text = mystr)) )
library(fortunes)
fortune(parse) # try several times
# I prefer this, but there is probably a better way
mycond- quote(c==1)
subset(foo, eval(bquote(.(mycond))) )
HTH,
baptiste
2009/8/21 Sebastien Bihorel
the short answer is to add [[i]] in your loop,
file_list[[i]] - paste(index$month[i], index$year[i], sep='')
yet a shorter answer would be,
file_list = apply(index, 1, paste, collapse=)
HTH,
baptiste
2009/8/20 Steve Murray smurray...@hotmail.com:
Dear R Users,
I have 120 objects stored
Try this,
print(p+ opts(plot.background= theme_rect(fill=NA)))
HTH,
baptiste
2009/8/19 rajesh j akshay.raj...@gmail.com:
Hi,
I plotted a histogram using ggplot2 and saved it as a pdf.However, the
portions outside the histogram dont appear transparent when I use a
non-white bg colour in my
Hi,
One way using ggplot2,
library(ggplot2)
ggplot(data=myda, mapping=aes(x=traits, y=..density..)) +
stat_density(aes(fill=factor), alpha=0.5, col=NA, position = 'identity') +
stat_density(aes(colour = factor), geom=path, position = 'identity', size=2)
HTH,
baptiste
2009/8/19 Mao Jianfeng
I believe you want x.intersp,
txt - c(Setosa Petals, Versicolor Sepals)
plot(1,1,t=n)
legend(top, txt, text.col=1:2, cex=0.7,
inset=c(0,1/3))
legend(center, txt, text.col=1:2, cex=0.7,
x.intersp = -0.5)
HTH,
baptiste
2009/8/19 Stefan Grosse singularit...@gmx.net:
On Wed, 19 Aug 2009
plot(1:10,ylab=expression(temperature *delta*t))
2009/8/19 e-letter inp...@gmail.com:
On 18/08/2009, Gavin Simpson gavin.simp...@ucl.ac.uk wrote:
On Tue, 2009-08-18 at 13:06 +0100, e-letter wrote:
On 17/08/2009, Michael Knudsen micknud...@gmail.com wrote:
On Mon, Aug 17, 2009 at 12:51 PM,
Try this,
a[ ,as.logical(colSums(a))]
mind an unfortunate logical vs integer indexing trap:
isTRUE(all.equal( a[ ,!!colSums(a)] , a[ ,colSums(a)] ))
[1] FALSE
HTH,
baptiste
2009/8/18 Alberto Lora M albertolo...@gmail.com:
Hi Everbody
Could somebody help me.?
I need to remove the
Hi,
If you have a data.frame, perhaps this can help,
tc = textConnection(carat cut color clarity depth table price x y z
1 0.23 Ideal E SI2 61.555 326 3.95 3.98 2.43
2 0.21 Premium E SI1 59.861 326 3.89 3.84 2.31
3 0.23 Good E VS1 56.965
Hi,
Try this,
layout(matrix(c(1,1,2,3), ncol=2, byrow=T))
hist(1:10)
plot.new()# empty space
plot(1:10)
HTH,
baptiste
2009/8/16 RAVI KAPOOR ravk...@gmail.com:
Hi
Can any one explain how i can divide the graphic window
into two rows and two columns -- allocate figure 1 all of row 1 and
Try this,
formatC(d %% 1e5, width=5, flag = 0, mode=integer)
[1] 00735 02019 04131 04217 04629 04822 10115 11605 14477
[10] 15314 15438 19040 19603 22735 22853 23415 24227 24423
HTH,
baptiste
2009/7/31 PDXRugger j_r...@hotmail.com:
I would like to recreate data so that only the last 5
to have numbers 1 to 22 instead of points on scatter
plot.
Suggest more.
Kind Regards
On Thu, Jul 30, 2009 at 11:57 PM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Hi,
Try this,
plot(1:5,1:5, t='p', pch=paste(1:5))
baptiste
2009/7/30 amna khan amnakhan...@gmail.com:
Dear
Hi,
you want only the x scale to be free,
xyplot(place~rank|type, data=df1,
panel= function(x, y, ..., subscripts)
{
panel.xyplot(x,y,..., subscripts)
require(grid)
panel.grid(h = -1,v = 0, lty=dotted)
grid.text(unit(x,native),
essentially the same,
object1 = object2 = object3 = data.frame(Distance = 1:10)
foo = function(o){
within(get(o), LogDist - log10(Distance))
}
my.objects = paste(object, 1:3,sep=)
lapply(my.objects, foo)
It is however advisable to group the initial objects in
Hi,
Chapter 8 of the lattice book has some examples (you can see the code
and figures on r-forge). Perhaps you could try something like this,
d = data.frame(x=1:10,y=1:10,f=sample(letters[1:2],10,repl=T))
axis.custom = function(side, ...){
if(side == bottom)
Hi,
Try this,
plot(1:5,1:5, t='p', pch=paste(1:5))
baptiste
2009/7/30 amna khan amnakhan...@gmail.com:
Dear Sir
I want to write the numbers 1,2,3,on a scatter plot instead of points,
like 1 corresponding to first point on plot, 2 corresponding second point
etc.
Help in this regard.
Try this,
files = paste('pred/Pred_pres_', letters[1:6], '_indpdt',sep=)
lapply(files, load)
HTH,
baptiste
2009/7/30 waltzmiester cwalt...@shepherd.edu:
I am trying to load binary files in the following fashion
load(pred/Pred_pres_a_indpdt)
load(pred/Pred_pres_b_indpdt)
several options are listed here:
http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:display-images
baptiste
Rainer M Krug schrieb:
Hi
while teaching R, the question came up if it would be possible to add
a picture (saved on the HDD) to a graph (generated by plot()), which
Try with ?segments,
x-seq(75,225,0.1)
plot(x,dnorm(x,mean=140, sd=15), type='l', col='navy')
#abline(v = 149, col = black)
segments(149, 0, 149, dnorm(149,140,15))
curve(dnorm(x,mean=150, sd=15),from=75, to=225, col='orange', add=TRUE)
HTH,
baptiste
2009/7/26 Mary A. Marion
try this,
library(ggplot2)
ggplot() + geom_histogram(aes(x=rnorm(100), fill=..count..))+
xlab(NULL)+
scale_y_continuous()+
opts(legend.position=none)
HTH,
baptiste
2009/7/22 RON70 ron_michae...@yahoo.com
I have following code on qplot :
library(ggplot2)
ggplot() +
?scale_fill_discrete()
qplot(x,y,data=data.frame(x=1,y=1,f=a),fill=f) +
scale_fill_discrete(test)
baptiste
HTH,
2009/7/21 rajesh j akshay.raj...@gmail.com
Hi,
I've used the following command in qplot
qplot(a$V1,geom=histogram,binwidth=0.15,fill =
factor(a$V2),ylab=Frequency,xlab=Rate);
try this,
do.call(rbind, tmp)
baptiste
2009/7/17 Angel Spassov anspas...@googlemail.com
Dear useRs and developeRs,
I am struggling with a simple but not obviously solvable issue. Suppose I
have the following list of data.frames called 'tmp':
a - data.frame(a=rnorm(10),b=letters[1:10])
Hi,
you could try the reshape package,
l = list(d1= data.frame(ID=letters[1:4],value=1:4),
d2= data.frame(ID=letters[1:4],value= -c(1:4)))
library(reshape)
m = melt(l)
cast(m, .~ID, fun=mean)
HTH,
baptiste
2009/7/15 Mark Na mtb...@gmail.com
Dear R-helpers,
I have a list
Alternatively, you could make use of transparency (on some devices), or use
ggplot2 to map the number of observations to the point size,
d =
read.table(textConnection(
x y
1 10
1 10
2 3
4 5
9 8
),head=T)
library(ggplot2)
# transparency
qplot(x, y, data=d,
Hi,
You could use ?rect
x = 1:5
y=1:5
plot(x,y,t=n,xaxs=i)
abline(h=y)
xlims = range(x)
y.rect = matrix(rep(y,each=2)[-c(1, 2*length(y))], ncol=2, byrow=T)
x.rect = matrix(rep(xlims), ncol=2,nrow=nrow(y.rect), byrow=T)
cols = 1:4
rect(x.rect[,1], y.rect[,1], x.rect[,2],
I've never tried it but I would have thought the package DescribeDisplay can
help you,
http://www.ggobi.org/describe-display/
baptiste
2009/7/3 David Winsemius dwinsem...@comcast.net
On Jul 3, 2009, at 1:35 PM, Veerappa Chetty wrote:
Hi , I have created a parallel coordinate plot using
?strip.custom
p -
xyplot(acet+chol+ino+acetp ~ zp,
group=grp,
data=data,
type=l,
scales=list(relation=free),
auto.key=list(title=
Neurotransmitters, border=TRUE))
update(p, strip=strip.custom(factor.levels=letters[1:4]))
HTH,
baptiste
2009/7/3
2009/7/1 miguel bernal mber...@marine.rutgers.edu
I think there is a package to visualize the links between
functions in a package, but I don't know its name (if anybody knows it, I
will love to know it).
reminds me of roxygen's callgraph (relies on graphviz), is that what you
meant?
For another generic approach, you might be interested in the Reduce
function,
rolling - function( x, window=seq_along(x), f=max){
Reduce(f, x[window])
}
x= c(1:10, 2:10, 15, 1)
rolling(x)
#15
rolling(x, 1:10)
#10
rolling(x, 1:12)
#10
Of course this is only part of the solution to the
Dieter Menne dieter.me...@menne-biomed.de
baptiste auguie-5 wrote:
pdf()
plot(1, xlab=expression(mu))
dev.off()
If I open this pdf in Illustrator CS4, there are two mu on top of each
other, giving it a somewhat bold aspect. Other characters not from the
symbol font are just
Dear list,
I'm manually editing a large collection of pdf files that I produced with R
in Adobe Illustrator. In doing so, I've had the surprise to see symbols
duplicated on top each other. The following code illustrates this,
pdf()
plot(1, xlab=expression(mu))
dev.off()
If I open this pdf in
see also `%but%.character` in the operators package.
rnorm %but% list( mean = 3 )
function (n, mean = 3, sd = 1)
.Internal(rnorm(n, mean, sd))
environment: namespace:stats
baptiste
[[alternative HTML version deleted]]
__
Following up on my previous post.
I've managed to have the function return a gList rather than plot everything
directly, but I get a rather obscure error message when I try to wrap the
grobs in a gTree with a rotated viewport,
Error in x$children[[i]] : attempt to select less than one element
Dear list,
Following a recent enquiry, I've been playing with the idea of creating a
colour gradient for a polygon, using the Grid package. The idea is to draw a
number of stripes of different colours, using the grid.clip function. Below
is my current attempt at this,
library(grid)
Is this what you want?
myfun - function(x, a=19, b=21){ return(a * x + b) }
mysecond.fun - function(a, b, cc=myfun, cc.args=list(a=2,b=15) ){
list(a=a, b=b, cc = function(x) cc(x, cc.args$a, cc.args$b))
}
mysecond.fun(a=1,b=2)$cc(x=12)
It may be that you're after a Curry (*) function, as in,
This will give you a greek character, see ?plotmath
grid.text(expression(mu*(s,t)), 0.5, unit(5, lines), vp=vp2)
The following works for me, it may be that you're using an outdated
version of R,
vp - viewport(
x = unit(0, npc),
y = unit(0, npc),
just = c(left, bottom),
xscale = c(-1, 1) ,
Hi,
I don't think the fill parameter can be a colour gradient. You'll need
to create small polygons, each with its own fill (200, say). Try this,
x= c(0, 0.5, 1)
y= c(0.5, 1, 0.5)
grid.polygon(x=x, y=y, gp=gpar(fill=grey90, col=grey90))
xx - seq(range(x)[1],range(x)[2], length=100)
yy -
[I neglected to check some details in the previous post]
This one should work better,
library(grid)
x= c(0, 0.5, 1)
y= c(0.5, 1, 0.5)
grid.polygon(x=x, y=y, gp=gpar(fill=NA, col=grey90)) # outer shell
xx - seq(range(x)[1],range(x)[2], length=100)
dx - diff(xx) # width of clipped triangles
triangle into
a another Figure I'm working on. But when I try to do that, this wonderful
triangle overwrites the other one. Have tried to append it with not much
luck..
Much appreciation to your help though!!!
Kexin
On 6/25/09, baptiste auguie baptiste.aug...@gmail.com wrote:
Hi,
I don't
You're right, I meant to write linesnot line. The strange thing is,
although line isn't listed in ?unit, it doesn't return an error on my
machine,
unit(-1, line)
[1] -1line
unit(-1, lines)
[1] -1lines
Reading from
http://svn.r-project.org/R/trunk/src/library/grid/src/unit.c line is
Hi,
Grid offers several functions to help drawing such graphs,
see Paul Murrell's Can R Draw Graphs? (useR! 2006)
I came up with this, as a quick example,
vp - viewport(
x = unit(0, npc),
y = unit(0, npc),
just = c(left, bottom),
xscale = c(-1, 1) ,
yscale = c(-1, 1))
vp2 - viewport( #
Wacek helped me out on a similar topic a while back,
ize =
function (d, columns = names(d), izer = as.factor)
{
d[columns] = lapply(d[columns], izer)
d
}
d = data.frame(x=1:10, y=1:10, z =1:10)
str( ize(d, 'y') ) # y is now a factor
str( ize(d, 1:2, `cumsum`) ) # x and y are affected
Hi,
You seem to have a glitch in one file,
testread12=read.table(Test100.txt, head = T)
str(testread12) # Column131 is converted to a factor
# $ Column131: Factor w/ 2920 levels --,-0.000122393,..
combining the second data set with this one will convert the new data
into factor for this
Steve Jaffe wrote:
The situation is that I know there is a function and know approximately what
the name is, and want to find the exact name. Is there a way of searching
for near-matches (similar to unix apropos). For example, I know there is a
function called something like allequal (or
Hi,
I tend to use a slightly modified version of stats::relevel, (from an
old thread on this list),
relevel =
function (x, ref, ...)
{
lev - levels(x)
if (is.character(ref))
ref - match(ref, lev)
if (any(is.na(ref)))
stop('ref' must be an existing level)
nlev - length(lev)
Commenting on this, is there a strong argument against modifying
relevel() to reorder more than one level at a time?
I started a topic a while back (recursive relevel,
https://stat.ethz.ch/pipermail/r-help/2009-January/184397.html) and I've
happily used the proposed change since then by
For the sake of brevity, I like to use this trick,
plot(0, 0)
mtext(~Monthly Precipitation (mm x *10^2*/month))
HTH,
baptiste
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
utkarshsinghal wrote:
Hi Jim,
What you are saying is correct. Although, my computer might not have
same speed and I am getting the following for 10M entries:
user system elapsed
0.559 0.038 0.607
Moreover, in the case of character vectors, it gets more than double.
In my
[correcting a stupid error in my previous post]
testTwoStages - function(x, y, head.stop = 100){
if(!isTRUE(all(head(x, head.stop) == head(y, head.stop
{
print(paste(quick test returned FALSE))
return(FALSE)
} else {
full.test = isTRUE(all(tail(x, length(x) - head.stop) == tail(y,
I knew I had seen this in action! But as you mention, most pages only
display ~~RDOC~~ at the moment.
I second the idea of using the wiki for such collaborative work. If the
current (r-devel) version of all help pages could be automatically
copied to the wiki, users would have a convenient way
Kenny Larsen wrote:
Hi All,
I have hunted high and low and tried dozens of things but have yet to
achieve the result I require. Below is my code (taken mostly from another
thread on here) thus far:
files-list.files()
files-files[grep('.wm4', files)]
labels-gsub('.wm4', '',files)
for(i in
Hi,
the grImport package provides some functionality for svg and postscript
graphics,
http://cran.r-project.org/web/packages/grImport/index.html
Best,
baptiste
Robbie Morrison wrote:
Dear R-help
I want to display an image file in a new plot frame.
SVG is my preferred format, but I
Paul Murrell wrote:
Hi
The bug is now fixed in the development version
(thanks to Duncan for the diagnosis and suggested fix).
Paul
Thank you both for your help and dedication!
Best regards,
baptiste
--
_
Baptiste Auguié
School of Physics
University of
Kenny Larsen wrote:
Hi,
A fairly basic problem I think, here although searching the inetrnet doesn't
seem to reveal a solution. I have a dataset with two columns of real
numbers. It is read in via read.table. I simply need to square the data in
the second column and then plot it. I have tried
jim holtman wrote:
try this:
Oh well, i spent the time writing this so i might as well post my
(almost identical) solution,
x-c(1:3, 6: 7, 10:13)
breaks = c(TRUE, diff(x) != 1)
data.frame(start = x[breaks], length = tabulate(cumsum(breaks)))
Hoping this works,
baptiste
x
Dear list,
I'm quite surprised by this,
unit(1:5,char)[-c(1:2)]
#4char 3char # what's going on??
while I expected something like,
c(1:5)[-c(1:2)]
# 3 4 5
Note that,
unit(1:5,char)[c(1:2)]
# 1char 2char # fine
?unit warns about unit.c for concatenating, but also says,
It is possible to
Ben Bolker wrote:
amor Gandhi wrote:
Hi,
I have gote the following data
x1 - c(rep(1,6),rep(4,7),rep(6,10))
x2 - rnorm(length(x1),6,1)
data - data.frame(x1,x2)
and I would like to compute the mean of the x2 for each individual of x1,
i. e. x1=1,4 and 6?
You'll probably get seven
Marie Sivertsen wrote:
Dear list,
I have a vector of elements which I want to combined each with each, but
none with itself. For example,
v - c(a, b, c)
and I need a function 'combine' such that
combine(v)
[[1]]
[1] a b
[[2]]
[1] a b
[[3]]
[1] b c
I am not very
401 - 500 of 724 matches
Mail list logo