Dear list,
subset has a 'drop' argument that I had often mistaken for the one in
[.factor which removes unused levels.
Clearly it doesn't work that way, as shown below,
d - data.frame(x = factor(letters[1:15]), y = factor(LETTERS[1:3]))
s - subset(d, y==A, drop=TRUE)
str(s)
'data.frame': 5
, at 9:49 AM, baptiste auguie wrote:
Dear list,
subset has a 'drop' argument that I had often mistaken for the one in
[.factor which removes unused levels.
Clearly it doesn't work that way, as shown below,
d - data.frame(x = factor(letters[1:15]), y = factor(LETTERS[1:3]))
s - subset(d, y
Hi,
From what I understand of your code, you might find the following
construct useful,
funs - c(mean, sum, sd, diff)
x - 1:10
lapply(funs, do.call, args=list(x))
and then working with lists rather than naming every object
individually. You might find mapply useful too when you have to pass
Hi,
An alternative with ggplot2,
library(ggplot2)
ggplot(data=coords) +
geom_segment(aes(x=a, xend=b, y=c, yend=c))
HTH,
baptiste
2009/11/16 David Winsemius dwinsem...@comcast.net:
On Nov 16, 2009, at 12:40 PM, Tim Smith wrote:
Hi,
I wanted to make a graph with the following table (2
Hi,
Try this,
set.seed(2) # reproducible
d = matrix(sample(1:20,20), 4, 5)
d
d[ d[ ,2] == 18 , ]
You may need to test with all.equal if your values are subject to
rounding errors.
HTH,
baptiste
2009/11/16 frenchcr frenc...@btinternet.com:
I have 20 columns of data, and in column 5 I have
?order
?sort
2009/11/16 frenchcr frenc...@btinternet.com:
In excel a handy tool is the sort data by column ...i.e. i can highlight the
whole dataset and sort it according to a particular column...like sort the
data in a column in acending or decending order where all the other columns
Hi,
You could try plyr,
library(plyr)
ddply(d,.(Name), tail,1)
Name Value
1A 3
2B 8
3C 2
4D 3
HTH,
baptiste
2009/11/16 Hao Cen h...@andrew.cmu.edu:
Hi,
I would like to extract the last row of each group in a data frame.
The data frame is as follows
Hi,
Not answering your question, but the tikzDevice package is another
option if you want to match LaTeX fonts seamlessly.
HTH,
baptiste
2009/11/17 Markus Jochmann markus.jochm...@strath.ac.uk:
Hi!
On Linux I try to produce pdf graphs with computer modern fonts so that they
look nice in
1 35 70 3.0 y
5 1 120 140 -1.3 n
6 1 180 190 0.2 y
## Code courtesy of BAPTISTE AUGUIE
library(ggplot2)
ggplot(data=x2) +
geom_segment(aes(x=start1, xend=end1, y=meth, yend=meth))
- Can I get lattice to do a similar graph for the panels?
thanks
Dear list,
I'm seeking advice to extract some numeric values from a log file
created by an external program. Consider the following example,
input -
readLines(textConnection(
some text
ax =1.3770E-03 bx =3.4644E-07
ay =1.9412E-04 by =4.8840E-08
other text
aax =
expression not needed
On Wed, Nov 18, 2009 at 7:28 AM, Henrique Dallazuanna www...@gmail.com
wrote:
Try this:
strapply(input, ([0-9]+\\.[0-9]+E-[0-9]+), c, simplify = rbind,
combine = as.numeric)
On Wed, Nov 18, 2009 at 9:57 AM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Dear
haven't checked it
carefully and would appreciate folks pointing out where it trips up (e.g.
perhaps with NA's).
Best,
Bert Gunter
Genentech Nonclinical Biostatistics
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of baptiste
3.4644e-07
2 0.00019412 4.8840e-08
3 0.00137700 3.4644e-07
4 0.00019412 4.8840e-08
On Wed, Nov 18, 2009 at 1:54 PM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Hi,
Thanks for the alternative approach. However, I should have made my
example more complete in that other lines may
I have seen pdf files with 3D objects embedded in it, using the U3D format,
http://en.wikipedia.org/wiki/Universal_3D
but I don't think there's a device for this in R; in fact there may
not even exist a third-party post-processing route available at this
time to bridge the gap between rgl and
Apr 2010, baptiste auguie wrote:
I have seen pdf files with 3D objects embedded in it, using the U3D
format,
http://en.wikipedia.org/wiki/Universal_3D
but I don't think there's a device for this in R; in fact there may
not even exist a third-party post-processing route available at this
time
Hi,
Another option might be the tikzDevice package, which uses LaTeX to
process the fonts,
library(tikzDevice)
tikz(standAlone=T)
plot(1,1, type = 'n')
mtext(side = 3, line = 2, $\\mu$)
dev.off()
## system(/usr/texbin/pdflatex Rplots.tex)
HTH,
baptiste
On 20 April 2010 07:30, Prof Brian
Hi,
Taking a wild guess, it looks to me that you might have overlaid
several times the same text,
plot.new()
text(0.5,0.5,rep(test,10))
HTH,
baptiste
On 20 April 2010 08:54, chrisli1223 chri...@austwaterenv.com.au wrote:
Hi all,
I have written a note near each of my graphs using mtext.
Hi,
This idea was also discussed when Paul Murrell first announced the
grid.raster function to R-devel,
http://tolstoy.newcastle.edu.au/R/e8/devel/09/12/0912.html
My personal conclusion was that vector fill patterns are generally
better in terms of resolution and speed. Of course the situation
Hi,
Lattice and ggplot2 are both ideally suited for this task. Consider
this example,
library(ggplot2)
d = data.frame(x=1:10, a1=rnorm(10), b1=rnorm(10))
m = melt(d, id =x) # reshape into long format
qplot(x, value, data=m, geom=path, colour=variable)
library(lattice)
xyplot(value~x, data=m,
Hi,
On 16 May 2010 03:31, michael westphal mi_westp...@yahoo.com wrote:
[ snipped ]
Any suggestions?
i'd suggest you
- read the posting guide
- upgrade your R to the latest version
- don't post to two mailing lists
- make your example minimal, self-contained, reproducible
- show the result of
Hi,
Try this,
saveMyWork - .Last.value
HTH,
baptiste
On 17 May 2010 15:07, math_daddy math_da...@hotmail.com wrote:
Hello.
I ran a simulation that took a few days to complete, and want to analyze the
results, but have just realized that I (idiotically) did not assign the
output to a
Hi,
try this,
m = matrix(runif(2000*2400), nrow=2000)
library(grid)
grid.raster(m)
HTH,
baptiste
On 17 May 2010 20:35, tetonedge de...@tetonedge.net wrote:
I have a matrix that is 2400x2000 and I would like to display it as an image,
I have tried image(), but due to the size of the matrix
No, that's only true for lattice and ggplot2 graphics. The problem
here is with this line,
windows(width=5, height=5)
which shouldn't be there.
HTH,
baptiste
On 17 May 2010 22:23, Jun Shen jun.shen...@gmail.com wrote:
If you do plotting in a loop, then you need to print it to the device.
Dear all,
I got a couple of warnings using panel.levelplot.raster,
In panel.levelplot.raster(..., interpolate = TRUE) :
'y' values are not equispaced; output will be wrong
although I was quite sure my data were equally spaced (indeed, I
created them with seq()). A closer look at the source
On 18 May 2010 15:30, Deepayan Sarkar deepayan.sar...@r-project.org wrote:
Maybe a better test would be
isTRUE(all.equal(diff(range(diff(ux))), 0))
I'll try that out for the next release.
Sounds good (and works for me), thanks.
baptiste
__
Dear list,
I am puzzled by this,
substitute(expression(x), list(x = factor(letters[1:2])))
# expression(1:2)
Why do I get back the factor levels inside the expression and not the
labels? The following work as I expected,
substitute(expression(x), list(x = letters[1:2]))
# expression(c(a, b))
Thank you for the explanation, and the fortune-ish quote,
“As the documentation for substitute() says, there is no guarantee
that the result makes sense.”
Best,
baptiste
On 19 May 2010 02:59, Duncan Murdoch murdoch.dun...@gmail.com wrote:
On 18/05/2010 4:36 PM, baptiste auguie wrote:
Dear
Hi,
See also ?lattice::xyplot and ?ggplot2::geom_point , either one can do
it automatically.
HTH,
baptiste
On 19 May 2010 12:24, Jannis bt_jan...@yahoo.de wrote:
Dears,
before I start programming my own function I would like to ask you whether
there is any function already available that
Hi,
Try this,
d - data.frame(a=1:4, b=3:6)
var - a
mean(d[var])
## or, if you are not aware of
## fortune(parse)
xx - paste(d$,var, sep=)
mean(eval(parse(text=xx)))
HTH,
baptiste
2009/11/19 William Simpson william.a.simp...@gmail.com:
I have quite a complicated problem that's hard to
Hi,
I think your ddply call with a calculation inside .( ) is the
problem. Are you sure you need to do this? Performing the cut outside
ddply seems to work fine,
determine_counts-function()
{
min_range-1
max_range-30
bin_range_size-5
Me_df-data.frame(Data =
Hi,
You can try this, though I hope to learn of a better way to do it,
a = c(quote(alpha),quote(beta),quote(gamma))
b = lapply(1:3, function(x) as.character(x))
c = c(quote('-10'^th),
quote('-20'^th),
quote('-30'^th))
testplot - function(a,b,c) {
text -
lapply(seq_along(a),
hi,
Try making your last line
invisible( list(table=xtb, elbat=btx) )
HTH,
baptiste
2009/11/22 Soeren.Vogel soeren.vo...@eawag.ch:
I have created a function to do something:
i - factor(sample(c(A, B, C, NA), 793, rep=T, prob=c(8, 7, 5, 1)))
k - factor(sample(c(X, Y, Z, NA), 793, rep=T,
Hi,
Try this,
do.call(expand.grid, lapply(7:3, seq, from=1))
HTH,
baptiste
2009/11/22 Peng Yu pengyu...@gmail.com:
I use the following code to generate a matrix of factors. I'm
wondering if there is a way to make it more general so that I can have
any number of factors (not necessarily
Hi,
it's a FAQ, you need to print() the plot,
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f
baptiste
2009/11/25 Ryan Archer ra.list...@gmail.com:
Hi,
I'm having trouble seeing graphics output from lattice xyplot() when called
from inside a
Hi,
I think you can use match.call() to retrieve the number of arguments
passed to a function (see below), but I don't think nargout makes
sense in R like it does in Matlab.
foo - function(...){
print(match.call())
nargin - length(as.list(match.call())) -1
print(nargin)
}
foo(a=1, b=2)
2009/11/26 Ted Harding ted.hard...@manchester.ac.uk:
Raising a rather general question here.
This is a tantalising discussion, but the notion of concave hull
strikes me as extremely ill-defined!
I'd like to see statement of what it is (generically) supposed to be.
I'm curious too, but I can
on CRAN implementing such an idea:
alphahull, phull is other package,
kjetil
On Thu, Nov 26, 2009 at 6:11 PM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
2009/11/26 Ted Harding ted.hard...@manchester.ac.uk:
Raising a rather general question here.
This is a tantalising discussion
Hi,
The error message,
Error in grid[i] - x + (i - 1) * (y - x)/m :
object of type 'closure' is not subsettable
indicates that grid is actually known to R as a function (type grid
to see its definition). You can define your own variable with the same
name, but that needs to be done before the
Hi,
Try this,
matrizt[is.na(matrizt)] - 0
HTH,
baptiste
2009/11/27 Romildo Martins romildo.mart...@gmail.com:
Hello,
how to replace the NA by number zero?
matrizt
[,1] [,2] [,3] [,4]
[1,] 1.000 NA NA NA
Hi,
They're not exported from the stats namespace,
stats:::.Diag
stats:::.asSparse
?:::
HTH,
baptiste
2009/11/29 Peng Yu pengyu...@gmail.com:
'.Diag' and '.asSparse' are defined in contrast.R. I'm wondering why I
don't see them in my R session. Is it because that they start with
'.'?
Hi,
an alternative to parse() is to use quote and bquote,
set.seed(123)
d = data.frame(a=letters[1:5], b=1:10, c=sample(0:1, 10, repl=TRUE))
cond1 - quote(a==b)
cond2 - quote(b 6)
cond3 - bquote(.(cond1) .(cond2))
subset(d, eval(cond1))
subset(d, eval(cond2))
subset(d, eval(cond3))
HTH,
Hi,
I don't understand why you used scale_manual_colour if you want only
black lines. To have different line types in the legend you can map
the linetype to the data,
huron - data.frame(year=1875:1972, level=LakeHuron)
ggplot(huron, aes(year)) +
geom_line(aes(y=level+5, linetype=above)) +
came across a thread in which baptiste auguie
said one general way to do this would be to compute the convex hull
(?chull) of the augmented set of points and test if the point belongs to
it; an approach I'd considered generalising to multiple points thus (pseudo
R code
Hi,
I think the size mismatch occurs because of a different default for
the fontsize (and grid.points has a size of 1 character by default).
Compare the following two examples,
# default
grid.newpage()
pushViewport(viewport(x=unit(0.5, npc), y=unit(0.5, npc)))
Hi,
try ?do.call
do.call(cbind, replicate(3, 1:10, simplify=FALSE))
HTH,
baptiste
2009/12/4 Lisa lisa...@gmail.com:
Hello, All,
I want to write a function to do some works based on the arguments. For
example, bind some variables (arguments) as this:
myfunction - function(arg1, arg2,
Hi,
If you can first convert the image to ppm format, the pixmap package
has an addlogo function that can do just what you want,
x - read.pnm(system.file(pictures/logo.ppm, package=pixmap)[1])
plot(1:10,1:10)
addlogo(x, px=c(2, 4), py=c(6, 8), asp=1)
One could probably get inspiration from the
Hi,
Try this,
cor(pollute[ ,c(Pollution,Temp,Industry)])
and ?[ in particular,
Character vectors will be matched to the names of the object
HTH,
baptiste
2009/12/5 John-Paul Ferguson ferguson_john-p...@gsb.stanford.edu:
I apologize for how basic a question this is. I am a Stata user who
Hi,
I think you have two options:
1- use a specific formatter in scale_x_continuous, e.g.
last_plot +
scale_x_continuous(formatter=percent)
2- specify breaks and labels,
last_plot +
scale_x_continuous(breaks=c(2,6), labels=paste(c(2,6),%))
HTH,
baptiste
2009/12/7 Megh
Hi,
I was about to send the exact same answer as you just received, so
I'll add a note instead. Your problem looks a bit like Currying,
Curry - # original from roxygen
function (f, ..., .left=TRUE)
{
.orig = list(...)
function(...){
if(.left) {args - c(.orig, list(...))} else
Hi,
You could define a function that does the calculations for a given
data.frame and apply it to all your data.frames,
d1 - data.frame(a=1:10, b=rnorm(10))
d2 - data.frame(a=-(1:10), b=rnorm(10))
calculations - function(d){
if(is.character(d)) d - get(d)
transform(d,
c =
Hi,
try this,
barchart(1:2, ylab=expression(mu*g/m^3))
?plotmath
baptiste
2009/12/9 Peng Cai pengcaimaill...@gmail.com:
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,
and (mu*g/m^3).
Thanks again,
Peng Cai
On Wed, Dec 9, 2009 at 12:02 PM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Hi,
try this,
barchart(1:2, ylab=expression(mu*g/m^3))
?plotmath
baptiste
2009/12/9 Peng Cai pengcaimaill...@gmail.com:
Hi All,
I'm trying to write ug/m3
-
baptiste auguie baptiste.aug...@googlemail.com wrote in message
news:de4e29f50912040550m71fbffafnfa1ed6e0f4451...@mail.gmail.com...
Hi,
Yet another one of my very naive ideas on the subject: maybe you can
first evaluate the circumscribed and inscribed
Hi,
Is the following close enough?
apply(set2, 2, function(x) x[is.na(x)])
HTH,
baptiste
2009/12/10 Andreas Wittmann andreas_wittm...@gmx.de:
Dear R-users,
after several tries with lapply and searching the mailing list, i want to
ask, wheter and how it is possibly to avoid the for-loop in
2009/12/10 Charles C. Berry cbe...@tajo.ucsd.edu:
[snipped]
Many?
set.seed(1234)
ps - matrix(rnorm(4000),ncol=4)
phull - convhulln(ps)
xs - matrix(rnorm(1200),ncol=4)
phull2 - convhulln(rbind(ps,xs))
nrp - nrow(ps)
nrx - nrow(xs)
outside - unique(phull2[phull2nrp])-nrp
done - FALSE
Hi,
.NotYetImplemented gives an example,
function ()
stop(gettextf('%s' is not implemented yet,
as.character(sys.call(sys.parent())[[1L]])),
call. = FALSE)
environment: namespace:base
HTH,
baptiste
2009/12/11 Hao Cen h...@andrew.cmu.edu:
Hi,
Is there a way to get the enclosing function
`[[.data.frame`
and more generally see Rnews Volume 6/4, October 2006 Accessing the Sources.
HTH,
baptiste
2009/12/13 Guillaume Yziquel guillaume.yziq...@citycable.ch:
Hello.
I'm currently trying to wrap up data frames into OCaml via OCaml-R, and I'm
having trouble with data frame
Hi,
Try this,
apply(expand.grid(letters[1:3], letters[24:26]), 1, paste,collapse=)
[1] ax bx cx ay by cy az bz cz
?expand.grid
HTH,
baptiste
2009/12/14 Amelia Livington amelia_living...@yahoo.com:
Dear R helpers,
I am working on the scenario analysis pertaining to various interest rates.
FAQ:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f
you need to print()
HTH,
baptiste
2009/12/16 c...@autistici.org c...@autistici.org:
Hi,
i have a script how i launch lattice to make a densityplot.
in the script:
jpeg(file=XXX.jpg)
Dear list,
I'm not so familiar with the internals of the fortunes package, but I
really like the interface. I was wondering if someone had implemented
a similar functionality to parse the entries of the R FAQ
http://cran.r-project.org/doc/FAQ/R-FAQ.html . Say, if I was to
answer a question Why
Hi,
Excellent, thanks for doing this!
I had tried the 2D case myself but I was put off by the fact that
Octave's convhulln had a different ordering of the points to R's
geometry package (an improvement to Octave's convhulln was made after
it was ported to R). I'm not sure how you got around this
Dear list,
In a little numbers game, I've hit a performance snag and I'm not sure
how to code this in C.
The game is the following: how many 8-digit numbers have the sum of
their digits equal to 17?
The brute-force answer could be:
maxi - 9 # digits from 0 to 9
N - 5 # 8 is too large
test - 17
2009/12/19 David Winsemius dwinsem...@comcast.net:
On Dec 19, 2009, at 9:06 AM, baptiste auguie wrote:
Dear list,
In a little numbers game, I've hit a performance snag and I'm not sure
how to code this in C.
The game is the following: how many 8-digit numbers have the sum of
their digits
)})
user system elapsed
34.050 1.109 35.791
I'm surprised by idx-c(idx,i), isn't that considered a sin in the R
Inferno? Presumably growing idx will waste time for large N.
Thanks,
baptiste
2009/12/19 David Winsemius dwinsem...@comcast.net:
On Dec 19, 2009, at 1:36 PM, baptiste auguie wrote
for the list]
2009/12/19 David Winsemius dwinsem...@comcast.net:
On Dec 19, 2009, at 2:10 PM, David Winsemius wrote:
On Dec 19, 2009, at 1:36 PM, baptiste auguie wrote:
2009/12/19 David Winsemius dwinsem...@comcast.net:
On Dec 19, 2009, at 9:06 AM, baptiste auguie wrote:
Dear list
Hi,
try this,
ylab = expression(Temperature~(degree*F))
?plotmath
baptiste
2009/12/20 Kim Jung Hwa kimhwamaill...@gmail.com:
Hi All,
I'm wondering if its possible to write degree in symbol.
I would like y-label as Temperature (degreeF). where degree should be in
symbols. Thanks in
Dear list,
I made the following example of a proto object that contains some data
and a spline interpolation. I don't understand why test$predict()
fails with this error message:
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
Best regards,
baptiste
test -
mean
to refer to stats::predict. Change the line that calls predict to:
stats::predict(.$spline(), x.fine)
On Sun, Dec 20, 2009 at 11:49 AM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Dear list,
I made the following example of a proto object that contains some data
and a spline
Hi,
Do you want a ternary plot?
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=34
It's easy to rotate an axis with Grid graphics,
library(grid)
pushViewport(viewport(0.5,0.5, width=0.5, height=unit(3, lines)))
grid.xaxis(at=seq(-0.5,0.5,by=0.1), vp=viewport(x=1, angle=-60))
HTH,
participated, I have learned interesting
things from a seemingly innocuous question.
Best regards,
baptiste
2009/12/21 Robin Hankin rk...@cam.ac.uk:
Hi
library(partitions)
jj - blockparts(rep(9,8),17)
dim(jj)
gives 318648
HTH
rksh
baptiste auguie wrote:
Dear list
Will this do?
temp - paste(m, 1:3, sep=,collapse=,)
HTH,
baptiste
2009/12/23 Knut Krueger r...@krueger-family.de:
Hi to all
I need a string like
temp - paste(m1,m2,m3,sep=,)
But i must know how many items are in the string,afterwards
the other option would be to use a vector
temp -
Isn't paste doing exactly this?
temp - c(November, December,Monday,Tuesday)
paste(temp, collapse=,)
# November,December,Monday,Tuesday
HTH,
baptiste
2009/12/23 Ted Harding ted.hard...@manchester.ac.uk:
On 23-Dec-09 11:08:02, Knut Krueger wrote:
Jim Lemon schrieb:
Not as easy as I thought
Hi,
Try this,
x - matrix(1:9, ncol=3, byrow=T)
sca - c(2.5, 1.7, 3.6)
x %*% diag(1/sca)
HTH,
baptiste
2009/12/27 Muhammad Rahiz muhammad.ra...@ouce.ox.ac.uk:
Hi useRs,
I ran into an inconsistent output problem again. Here is the simplify
illustration
I've got a matrix as follows
x
Hi,
Try print(p) instead of plot(p)
HTH,
baptiste
2009/12/29 Bryan Hanson han...@depauw.edu:
I¹m trying to build a simple formula interface to work with a function using
ggplot2. The following scheme ³works² up until the plot(p) request, at which
point there are complaints about xlim¹s and
Hi,
I think you can also use plyr for this,
dft - read.table(textConnection(P1idVeg1Veg2AreaPoly2 P2ID
1 p p 1 1
1 p p 1.5 2
2 p p 2 3
2 p h 3.5 4),
Hi,
Here is some artificial data followed by minimal ggplot2 and lattice examples,
makeUpData - function(){
data.frame(x=sample(letters[1:4], 100, repl=TRUE), y=rnorm(100))
}
datasets - replicate(15, makeUpData(), simplify=FALSE)
names(datasets) - paste(dataset, seq_along(datasets), sep=)
as a book.
Lattice also has a dedicated book, and a companion website with the figures,
http://r-forge.r-project.org/projects/lmdvr/
HTH,
baptiste
2009/12/29 baptiste auguie baptiste.aug...@googlemail.com:
Hi,
Here is some artificial data followed by minimal ggplot2 and lattice examples
Hi,
You can set up a Grid layout with one viewport at the bottom and
another on the left and use grid.text to add your labels. An example
is given below using grid.pack.
The gridExtra package provides a convenient wrapper for these regular
arrangements of plots,
##library(gridExtra)
Hi,
Using backticks might work to some extent,
library(lattice)
`my variable` = 1:10
y=rnorm(10)
xyplot(`my variable` ~ y)
but if your data is in a data.frame the names should have been converted,
make.names('my variable')
[1] my.variable
HTH,
baptiste
2010/1/3 Jay josip.2...@gmail.com:
Hi,
Thank you for this fun package.
I recently posted a related question on R-help that seemed to pass
unnoticed. Basically, I suggested that the functionality of fortunes
could be extended to R FAQ entries, also allowing contributed packages
to provide their own (fortune or) faq data file. My
Hi,
Something like this maybe,
plot.new()
lab = expression(bar(T)*(*-x* ; *alpha*)-G*(*x* ; *alpha* , *J*))
text(0.5,0.5,lab)
?plotmath
HTH,
baptiste
2010/1/8 bernardo lagos alvarez blacert...@gmail.com:
Dear useRs,
How can I, writting the correct greek letter using postscrip or pdf
Hi,
ggplot2 or lattice could help you in creating the plots. Adding a
summary will however require some play with Grid graphics; either
using gridBase to mix lattice / ggplot2 output with base R graphics
(e.g. textplot() from some package I forget), or you'll need to
produce the textual summary
On 1 June 2010 11:34, Peter Ehlers ehl...@ucalgary.ca wrote:
Or, for a very slight further reduction in time in
the case of larger matrices/vectors:
as.vector(tcrossprod(V, xyzs))
I mention this merely to remind new users of the
excellent speed of [t]crossprod().
-Peter Ehlers
Thanks,
Hi,
You could use melt from the reshape package to create a long format
data.frame. This is more easy to plot with lattice or ggplot2, and you
can then use facetting to arrange several plots on the same page. The
dummy example below produces 10 pages of output with 10 graphs per
page.
Hi,
It's not clear what you mean by summary text without a minimal
reproducible example. If your text is ordered as a matrix or a
data.frame, you might want to try this grid function,
gridExtra::grid.table(as.matrix(summary(iris)), theme=theme.white())
If your text has the form of a paragraph,
Hi,
I think you could use a concave hull from the alphahull package,
http://yihui.name/en/2010/04/alphahull-an-r-package-for-alpha-convex-hull/
It may be difficult to find the right parameters if the polygons
differ widely in edge lengths, though.
HTH,
baptiste
On 2 June 2010 03:53, Remko
On 2 June 2010 07:55, Deepayan Sarkar deepayan.sar...@gmail.com wrote:
Something like this should also work, except that the grob produced by
tableGrob() doesn't seem to know its height.
Indeed, I have not been successful in writing good
widthDetails/heightDetails methods for this grob since
Hi,
On 3 June 2010 05:26, Paul Murrell p.murr...@auckland.ac.nz wrote:
Or the same drawing calculations have to be repeated within
width/heightDetails - those methods should get run within the same graphical
context as the drawDetails method.
Yes, the idea crossed my mind, but I did not
Try
text(0.8,1,bquote(*sigma*==.(round(m,2))*±*.(round(sig,2
?bquote
?plotmath
On 5 June 2010 11:36, Thomas Bschorr bsch...@phys.ethz.ch wrote:
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
15:30, Deepayan Sarkar deepayan.sar...@r-project.org wrote:
On Tue, May 18, 2010 at 6:32 PM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Dear all,
I got a couple of warnings using panel.levelplot.raster,
In panel.levelplot.raster(..., interpolate = TRUE) :
'y' values
such duplication of
calculations at drawing time), or do they have to be completely
independent in the implementation?
Best,
baptiste
On 3 June 2010 07:58, baptiste auguie baptiste.aug...@googlemail.com wrote:
Hi,
On 3 June 2010 05:26, Paul Murrell p.murr...@auckland.ac.nz wrote:
Or the same drawing
Hi,
Try this,
library(png)
example(readPNG)
HTH,
baptiste
On 6 June 2010 13:46, oliver oli...@first.in-berlin.de wrote:
Hello,
how can I load an external picture/image file to screen?
I want to use locator() then to get coordinates of that picture...
...in other words I want to use R
Hi,
ggplot2 and lattice also provide convenient ways to arrange multiple
plots on a page. For tables, there's also a function based on Grid
graphics in the gridExtra package.
A typical dummy example might be,
library(ggplot2)
library(gridExtra)
p = qplot(Sepal.Length, Petal.Length, data=iris,
On 7 June 2010 01:16, Oliver oli...@first.in-berlin.de wrote:
baptiste auguie baptiste.auguie at googlemail.com writes:
Hi,
Try this,
library(png)
example(readPNG)
[...]
If rasterImage would be available, I think this would be the right hint.
It is available when you use the latest
The OP asked for a smooth curve,
foo = splinefun(x,y)
curve(foo, min(x), max(x))
# points(x,y)
I'm sure a R wizard could make it a one-liner.
HTH,
baptiste
On 10 June 2010 16:48, Mario Valle mva...@cscs.ch wrote:
x-c(1:6)
y-c(.01,.09,.08,.03,.001,.02)
plot(x,y, type='l')
Please try ?plot
Hi,
You could reorder the factor levels before plotting,
x$n = factor(x$n, levels=c(va,vp, letters[1:3]))
last_plot() %+% x
or you could avoid using factors in the first place,
x - data.frame(cbind(n,p,pm,pn), stringsAsFactors=FALSE)
last_plot() %+% x
HTH,
baptiste
On Thu, Jun 10, 2010
Dear all,
I use the following to create a list of identical grobs,
require(grid)
rep.grob - function(g, n){
replicate(n, g, simplify=FALSE)
}
This approach suffers two problems:
1- R CMD check is not happy about the S3-like name. How can / Should I
make this a real S3 method?
2- I don't know
Hi,
Try this,
## create a 2D grid with random point sizes
d = expand.grid(x=1:10,y=1:10)
d$size = runif(nrow(d), 1,5)
## create some random links
links= d[sample(seq(1,nrow(d)),20),]
links$id = sample(2:6, nrow(links),repl=T)
## plot
library(ggplot2)
ggplot(d, mapping=aes(x,y)) +
Try this,
qplot(factor(0), mpg, data=mtcars, geom=boxplot, xlab=)+
coord_flip() + scale_x_discrete(breaks=NA)
HTH,
baptiste
On 18 June 2010 16:47, Jacob Wegelin jacobwege...@fastmail.fm wrote:
In ggplot2, I would like to make a boxplot that has the following
properties:
(1) Contrary to
Hi,
Another option would be the tikzDevice package, which lets you process
all the text of your plot with LaTeX. I think the XeTeX variant might
be the most straight-forward to mix different fonts using this
approach.
HTH,
baptiste
On 29 June 2010 16:17, Jinsong Zhao jsz...@mail.hzau.edu.cn
101 - 200 of 724 matches
Mail list logo