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
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
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,
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,
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
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
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
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,
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
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,
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,
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,
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,
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
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,
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
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
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
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)
Hi,
Maybe the textplot() function in the gplots package?
HTH,
baptiste
2009/9/21 Sergey Goriatchev serg...@gmail.com:
Hello everyone,
I have a plot and I want to but a (formatted) box containing text and
numbers, say:
Mean: 0.1
St.Deviation: 1.1
Skewness: 1.1
Kurtosis: 0.5
I know
() function.
No, there must be another function somewhere that produces these text boxes.
Best,
Sergey
On Mon, Sep 21, 2009 at 11:49, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Hi,
Maybe the textplot() function in the gplots package?
HTH,
baptiste
2009/9/21 Sergey Goriatchev serg
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,
The short answer would be ?paste (as in paste(year, .csv, sep=) ),
but I'd suggest you try this instead,
lf - list.files(pattern = .csv)
lf
# [1] 2003.csv 2004.csv 2005.csv
ln - gsub(.csv, , lf)
ln
# [1] 2003 2004 2005
length(ln)
lapply(lf, read.csv)
?list.files
?lapply
HTH,
baptiste
yet another way,
x - read.table(textConnection(Category Value
+ b1
+ b2
+ a7
+ a1), header=TRUE)
y = transform(x, Category = relevel(Category, c(b)))
str(y)
'data.frame': 4 obs. of 2 variables:
$ Category: Factor w/ 2
Hi,
It's trivial with ggplot2,
library(ggplot2)
qplot(tp,dp, geom=line) + scale_y_reverse()
HTH,
baptiste
2009/9/23 David Winsemius dwinsem...@comcast.net:
On Sep 23, 2009, at 7:58 AM, FMH wrote:
Dear All,
Let:
dp: depth of the river
tp: temperature with respect to depth
We can have
Try this,
d - na.omit(data.frame(tp,dp))
plot(d, t=l, ylim=rev(range(d$dp)))
?na.omit
HTH,
baptiste
2009/9/23 FMH kagba2...@yahoo.com:
Thank you for the code. I found that the coding does not work if there is an
NA in dp variable. For instance;
#
dp -
Hi,
try ?as.layer in the latticeExtra package.
HTH,
baptiste
2009/9/24 Larry White ljw1...@gmail.com:
I have two xyplots that i want to superimpose (code below). By default they
are displayed on slightly different y scales (one runs from 10 to 25, the
other from 10 to 30). I would like to
Try this,
testFun - function(x,y) plot(x,y, main=paste(plot
of,deparse(substitute(x)),and, deparse(substitute(y))) )
a1 - 5:8
b1 - 9:6
testFun(a1,b1)
?deparse
HTH,
baptiste
2009/9/24 Wolfgang Raffelsberger wr...@igbmc.fr:
Dear guRus,
I'd like to learn how to make a function recognize
Try these three options,
dp - c(1,4,3,2,5,7,9,8,9,2)
tp - 1:10
group - factor(c(1, 2, 1, 2, 1, 3, 1, 3, 3, 2), label=letters[1:3])
plot(tp,dp, type= 'p', col = group)
d - data.frame(dp=dp, tp=tp, group=group)
library(lattice)
xyplot(dp~tp, data=d, groups=group, auto.key=TRUE)
OK, it makes sense. Let's try that.
Best,
baptiste
2009/9/25 Paul Murrell p.murr...@auckland.ac.nz:
Hi
baptiste.auguie wrote:
(Sorry about the double post earlier, googlemail is having hiccups today)
2009/9/24 Romain Francois romain.franc...@dbmail.com:
Why just grid ? why not a list
2009/9/25 Felix Andrews fe...@nfrac.org:
Sorry, doubleYScale is not appropriate, since you specifically want a
common y scale.
I think Baptiste was suggesting to use layer(), rather than
as.layer():
Truth be told, I wasn't quite sure what the initial request meant. I
took it quite literally,
)
2009/9/25 Paul Murrell p.murr...@auckland.ac.nz:
Hi
baptiste auguie wrote:
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
Hi,
it works for me with plyr version 0.1.9. Try upgrading to the latest
version, or post your sessionInfo()
HTH,
baptiste
2009/9/25 Veerappa Chetty chett...@gmail.com:
Hi,I am using the amazing package 'plyr. I have one problem. I would
appreciate help to fix the following error: Thanks.
Hi,
I just tried a fourth variant, closer to what ggplot2 uses (I think):
to each grob is assigned a viewport with row and column positions (in
my example during their construction, with ggplot2 upon editing), and
they're all plotted in a given grid.layout. The timing is poor
compared to pushing
Hi,
I think you are feeding two expressions to xlab instead of one.
Try this instead,
xyplot(y ~ x, dat,xlab=expression(Moran's * italic(I)))
HTH,
baptiste
2009/9/26 Andrewjohnclose a.j.cl...@ncl.ac.uk:
Hi all, can anyone suggest a reason as mto why my xlab is plotting this text
at
Hi,
You said,
sumstats - c(mean,sd)
sumstats[1]
#Gives this error
but this is not an error! You created a list that contains two
functions, and sumstats[1] simply prints the first one.
HTH,
baptiste
__
R-help@r-project.org mailing list
Dear list,
The dichromat package defines a dichromat function which Collapses
red-green color distinctions to approximate the effect of the two
common forms of red-green colour blindness, protanopia and
deuteranopia.
library(dichromat)
library(grid)
colorStrip -
function (colors = 1:3, draw =
Try this,
library(ggplot2)
apply(matrix(10*rnorm(10),2), 1, ggplot2::rescale)
HTH,
baptiste
2009/9/28 Dry, Jonathan R jonathan@astrazeneca.com:
Hello all
I have a data frame representing a matrix of data. For each of my variables
(rows) I want to scale the data between 0
Also, have a look at each() in the plyr package,
library(plyr)
each(length, mean, var)(rnorm(100))
baptiste
2009/9/28 trumpetsaz stephaniezim...@gmail.com:
I am trying to write a function that will have an input of a vector of
functions. Here is a simplistic example.
sumstats - c(mean,sd)
Not answering your question, but just pointing out the example of
base::.NotYetImplemented()
essentially doing the same thing.
Best,
baptiste
2009/9/28 Rolf Turner r.tur...@auckland.ac.nz:
I have vague recollections of seeing this question discussed on r-help
previously, but I can't find
Hi,
If you are curious you might like to try a highly experimental Grid
function I wrote some time ago,
library(grid)
source(http://gridextra.googlecode.com/svn/trunk/R/patternGrob.r;)
grid.newpage()
grid.pattern(x=seq(1/6, 5/6, length=6), width=unit(1/8,npc),
height=unit(0.5,npc),
Hi,
A minimalist example using Grid graphics,
library(RGraphics)
bwImage - function(m, cols=c(white, black),
draw=TRUE, gp=gpar()){
g - imageGrob(nrow(m), ncol(m),
cols=cols[m+1], gp=gp)
if(draw)
grid.draw(g)
return(g)
}
m - matrix(rnorm(200) 0,
On 26 February 2010 11:12, Lorenzo Isella lorenzo.ise...@gmail.com wrote:
Thanks Augustine and Jim for the prompt reply.
You both answered my question. To avoid another post, I would simply like to
know if something along these lines is doable also with ggplot2.
Many thanks
Lorenzo
Hi,
I think I would follow this approach too, using updatelist() from the
reshape package,
updatelist - function (x, y)
{
common - intersect(names(x), names(y))
x[common] - y[common]
x
}
myfunction=function(list1=NULL, list2=NULL, list3=NULL){
list1=updatelist(list(variable1=1,
Point well taken --- grid::gpar() is also a good example; I'll make
use of your suggestion in my future coding.
Best,
baptiste
On 27 February 2010 15:02, Barry Rowlingson
b.rowling...@lancaster.ac.uk wrote:
On Sat, Feb 27, 2010 at 11:29 AM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
Hi,
The 3 packages I load most often are my own; typically I make a new
package for every new job. It automatically loads other packages as
dependencies (top-ranked are ggplot2, reshape, plyr) as well as my
data and functions I'm currently working with.
If some functions evolve further towards a
c(x - 1:5, rev(x[-length(x)]))
On 5 March 2010 07:04, kensuguro magronb...@gmail.com wrote:
I'm just beginning R, with book Using R for Introductory Statistics, and one
of the early questions has me baffled. The question is, create the
sequence: 1,2,3,4,5,4,3,2,1 using seq() and rep().
Hi,
try this,
data.frame(x,as.numeric(x %in% y))
HTH,
baptiste
On 7 March 2010 21:06, joseph jdsan...@yahoo.com wrote:
hello
can you show me how to create a data.frame from two factors x and y. column 1
should be equal to x and column 2 is 1 if it is common to y and 0 if it is
not.
Hi,
it's generally considered a bad practice but try this,
eval(parse(text=AA))
library(fortunes)
fortune(106)
HTH,
baptiste
On 10 March 2010 07:46, jq81 jingqia...@gmail.com wrote:
My question is represented by the following example.
For example, I have a character string a, which is
Dear all,
I'm trying to write tabular data to a text file, these data will be
the input of a Fortran program. The format needs to be
(i7,2x,7(e15.7,2x)). I have not been able to find a clean way of
producing this output with write.table. I searched for a
write.fortran function similar to
Hi,
last_plot() + scale_fill_grey()
should do it
HTH,
baptiste
On 10 March 2010 09:46, Johannes Graumann johannes_graum...@web.de wrote:
Hello,
I'd like to sitch to a monochrome/bw color-palette for the filling of
geom_bar-bars (produced via qplot as in the example below). Hours of
On Wednesday 10 March 2010 10:29:05 baptiste auguie wrote:
Hi,
last_plot() + scale_fill_grey()
should do it
HTH,
baptiste
On 10 March 2010 09:46, Johannes Graumann johannes_graum...@web.de wrote:
Hello,
I'd like to sitch to a monochrome/bw color-palette for the filling of
geom_bar-bars
Thanks, it is indeed a bit cleaner. I was hoping for a more generic
solution but I guess people use cat() and sprintf() in such cases.
Thanks,
baptiste
On 10 March 2010 12:46, Berend Hasselman b...@xs4all.nl wrote:
baptiste auguie-5 wrote:
This is a lot easier
for(k in
seq(1,nrow(m
, \n), c(1, 6, 1)), file = )
On Wed, Mar 10, 2010 at 7:52 AM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Thanks, it is indeed a bit cleaner. I was hoping for a more generic
solution but I guess people use cat() and sprintf() in such cases.
Thanks,
baptiste
On 10 March 2010 12:46
Dear list,
I'm trying to arrange various grid objects on a page using a
frameGrob. It works fine with basic grobs (textGrob, gTree, etc.), and
also with ggplot2 objects using the ggplotGrob() function. I am
however stuck with lattice. As far as I understand, lattice produces a
list of class
try this one,
`%ni%` - Negate(`%in%`)
Best,
baptiste
__
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,
:
What's wrong with using grid.grabExpr?
p1 - xyplot(1:10 ~ 1:10)
g1 - grid.grabExpr(print(p1))
I can imagine there would be potential problems to do with the
plot-time aspect and layout calculations...
On 19 March 2010 21:51, baptiste auguie baptiste.aug...@googlemail.com
wrote:
Dear
Hi,
On 24 March 2010 23:22, Paul Murrell p.murr...@auckland.ac.nz wrote:
Hi
baptiste auguie wrote:
Thanks Felix and Paul. I had overlooked grid.grabExpr, assuming that
one had to draw on a device before grabbing the output.
Now I'm not sure if there's any difference between either
Hi,
One option with Grid graphics,
m -
matrix(c( 1667,3,459,
2001, 45, 34,
1996, 2,5235),
dimnames=list(c(Eric Alan, Alan,John David)),
ncol=3, byrow=T)
## install.packages(gridExtra, repos=http://R-Forge.R-project.org;)
library(gridExtra)
Hi,
Barry suggested a way to place the text labels; I would like to point
out the grid.curve() function that might help in connecting the labels
with nice-looking curves. I don't know of a base graphics equivalent
(xspline() might come close) so it might be best to opt for Grid.
HTH,
baptiste
, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Hi,
Barry suggested a way to place the text labels; I would like to point
out the grid.curve() function that might help in connecting the labels
with nice-looking curves. I don't know of a base graphics equivalent
(xspline() might come close
(stringWidth(labels)), npc))
}
grid.arcText - function(...)
grid.draw(arcTextGrob(...))
set.seed(1234)
grid.newpage()
grid.arcText()
On 7 April 2010 23:13, baptiste auguie baptiste.aug...@googlemail.com wrote:
The following grob might be a starting point. I couldn't find a clean
way of orienting
try this,
install.packages(expm, repos=http://R-Forge.R-project.org;)
On 8 April 2010 17:28, arindam fadikar arindam.fadi...@gmail.com wrote:
On Thu, Apr 8, 2010 at 5:38 PM, David Winsemius dwinsem...@comcast.netwrote:
On Apr 8, 2010, at 1:45 AM, arindam fadikar wrote:
Dear users,
How
Hi,
On 12 April 2010 22:07, Peter Jepsen p...@dce.au.dk wrote:
3. Are there R packages that can draw tables?
the gplots package has a textplot() function, and the gridExtra
package a tableGrob(),
http://rwiki.sciviews.org/doku.php?id=tips:graphics-grid:table
In theory it should be possible
Hi,
You could try grid.colorstrip() from the gridExtra package,
grid.colorstrip(ifelse(dat, blue, red))
or grid.raster(), which should be more efficient,
grid.raster(matrix(ifelse(dat, blue, red)), interp=FALSE,
width=unit(1,npc), height=unit(1,npc))
HTH,
baptiste
On 15 July 2011 22:20,
Dear list,
I have two questions regarding grid.symbols() in the grImport package.
This package allows you to import a vector graphic in R, and
grid.symbols() can be used to plot the resulting glyph at arbitrary
locations in a grid viewport.
I have tried the code in the grImport vignette, which
A barplot rendered with povray,
http://zoonek2.free.fr/UNIX/48_R/03.html#10
At the other end of the spectrum,
library(txtplot)
x - factor(c(orange, orange, red, green, green, red,
yellow, purple, purple, orange))
o - capture.output(txtbarchart(x))
library(gplots)
textplot(o)
Hi,
Try this,
?capture.output
as in,
capture.output(cat(this is it))
HTH,
baptiste
PS: Here's another example for fun,
# begin absurd example
library(textplot)
capture.output(txtplot(1:10))
library(gplots)
textplot(capture.output(txtplot(1:10)))
library(grid)
grid.cap()
# not sure how to
Here's a warning, but it sounds like it's at a deep (C, presumably) level,
xfig()
grid::grid.rect(gp=gpar(fill=red, alpha=0.5))
Warning message:
In grid.Call.graphics(L_rect, x$x, x$y, x$width, x$height,
resolveHJust(x$just, :
semi-transparency is not supported on this device: reported only
501 - 600 of 724 matches
Mail list logo