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
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,
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
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,
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)) +
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
'.'?
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,
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
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,
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,
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 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 =
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
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
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
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,
One way would be,
vec[ cumsum(!vec)==0 ]
HTH,
baptiste
2009/11/9 Grzes gregori...@gmail.com:
Hi !
I have a vector:
vec= TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE TRUE TRUE FALSE
and I'm looking for a method which let me get only the first values equal
TRUE from this vector.
Hi,
Maybe something like this (inspired by ?cut),
cut2num - function(f){
labs - levels(f)
d - data.frame(lower = as.numeric( sub(\\((.+),.*, \\1, labs) ),
upper = as.numeric( sub([^,]*,([^]]*)\\], \\1, labs) ))
d$midpoints - rowMeans(d)
d
}
a - c(1, 2, 3, 4, 5, 2, 3,
Hi,
It looks like SAGE might be another option,
http://www.sagemath.org/index.html
though I never tried it.
HTH,
baptiste
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
Hi,
try this,
plot.new()
x=0.8
text(0.5, 0.5, bquote(rho == .(x)))
HTH,
baptiste
2009/11/3 j.delashe...@ed.ac.uk:
I'm trying something that I thought would be pretty simple, but it's proving
quite frustrating...
I want to display, for instance, the correlation coefficient rho in a
Hi,
Try this,
x = rnorm(1)
y = rnorm(1)
leg = bquote(r^2*=*.(round(x,digits=3))*, P=*.(round(y, digits=3)))
plot.new()
legend (bty =n,topright,legend=leg)
HTH,
baptiste
2009/11/2 Jacob Kasper jacobkas...@gmail.com:
I know that this has been revisited over and over, yet I cannot figure out
2009/10/30 hadley wickham h.wick...@gmail.com:
I read anything that mentions
ggplot2 no matter where it is.
... one should hope this statement only applies to the Internet
though, does it? Please do share your regexp if it's not the case.
:)
baptiste
Hi,
Try this,
files - paste(RA94010,1:3,sep=)
# or files - list.files(pattern = RA94010)
list.of.data - lapply(files, read.table, header=F)
# if required, collapse into a single data.frame
do.call(rbind, list.of.data)
HTH,
baptiste
2009/10/28 Sybille Wendel wendel.sybi...@googlemail.com:
Hi,
From ?par,
Value
When parameters are set, their former values are returned in an
invisible named list.
Therefore opar - par(col=red) will not contain col=red.
HTH,
baptiste
2009/10/27 Janke ten Holt j.c.ten.h...@rug.nl:
This seems to work indeed. But I don't understand why... I would
Hi,
From ?read.csv
Alternatively, file can be a readable text-mode connection (which
will be opened for reading if necessary, and if so closed (and hence
destroyed) at the end of the function call)
HTH,
baptiste
2009/10/27 Peng Yu pengyu...@gmail.com:
I don't understand why I can not close
Dear list,
I have the following text to parse (originating from readLines as some
lines have unequal size),
st = c(START text1 1 text2 2.3, whatever intermediate text, START
text1 23.4 text2 3.1415)
from which I'd like to extract the lines starting with START, and
group the subsequent fields in
then grep out the
START fields first.
On Mon, Oct 26, 2009 at 9:30 AM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Dear list,
I have the following text to parse (originating from readLines as some
lines have unequal size),
st = c(START text1 1 text2 2.3, whatever intermediate
Hi,
I don't know if it helps, but looking at the output of xyplot you can
extract the legend (a grid.frame) as follows,
library(grid)
library(lattice)
p = xyplot(x~y, group=x,data=data.frame(x=1:10,y=1:10),
auto.key=list(space=right))
legend = with(p$legend$right,
Hi,
You'll probably find that there are two parts to your query:
1- import a bitmap into R, for this I'd suggest the wiki page,
http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:display-images
2- place the image (now some sort of matrix of colour points) at
different locations on a
-
project.org] On Behalf Of baptiste auguie
Sent: Sunday, October 04, 2009 3:33 AM
To: r-help
Subject: Re: [R] add lines() to 1st plot in layout() after calling 2nd
plot()?
Hi,
Try this,
dev.new()
layout(matrix(1:4,2, by=T))
plot(1:10,main=top left plot)
plot(1:10,main=top right plot
Hi,
I think this is a case where you should use the ?[[ extraction
operator rather than $,
d = data.frame(a=1:3)
mytarget = a
d[[mytarget]]
HTH,
baptiste
2009/10/11 tdm ph...@philbrierley.com:
Hi,
I am passing a data frame and field name to a function. I've figured out how
I can create
Hi,
the abind package can help you with the first query,
## add values
library(abind)
arr - abind(arr,arr[1,,,] * 2 + 1,along=1)
dim(arr)
as for the second, maybe you can use negative indexing,
## remove values
arr - arr[-2,,,]
HTH,
baptiste
2009/10/11 ampc ampc2...@gmail.com:
Hi,
Like this perhaps?
slope = diff(y) / diff(x)
str(slope)
num [1:499] 1.5068 -1.8406 2.1745 0.0676 -2.6088 ...
HTH,
baptiste
2009/10/8 FMH kagba2...@yahoo.com:
Dear All,
Let 499 piece-wise lines were buit up by 500 pair of observations, via R
code below.
x - 1:500
y - rnorm(500)
Hi,
Try the useOuterStrips function in the latticeExtra package.
HTH,
baptiste
2009/10/8 Christian Ritter crit...@ridaco.be:
Dear all,
I want to split the strips in xyplot and push them into the margins ...
Tried to find this in common documentation (such as Deepayan's book) on
lattice
Dear all,
In mucking around with ggplot2, I've hit the following snag,
library(ggplot2)
# this returns a grob, OK
GeomAbline$icon()
# lines[GRID.lines.9]
# this returns the function icon, OK
GeomAbline$icon
# proto method (instantiated with ): function (.)
# linesGrob(c(0, 1), c(0.2, 0.8))
#
... without answering my previous question, I have just found a
fortune-hate workaround,
getIcon - function(geom){
st - paste(Geom, firstUpper(geom),$icon, sep=)
eval(parse(text=st))
}
getIcon(abline)
I'm still curious about the get() behaviour though.
Best,
baptiste
Hi,
with assign,
foo - function(var){
assign(var, var+1, envir = .GlobalEnv)
}
var =1
foo(2)
var
# [1] 3
HTH,
baptiste
2009/10/8 devol sund...@gmail.com:
Dear all,
could you please advice whether it is possible somehow to modify an
external (from the point of some function view)
Hi,
Your two data sets have a different year so I'm not sure what you want
to do with the x axis.
The code below plots both data sets on the same graph, with a range of
two years,
d1 - read.table(~/Downloads/2005.txt)
d2 - read.table(~/Downloads/2006.txt)
cleanup - function(d){
names(d) -
Hi,
Try this,
x= my title
plot(1,1, main = bquote(italic(.(x
HTH,
baptiste
2009/10/6 Jacob Kasper jacobkas...@gmail.com:
Part of my script reads:
speciesName - names(data)[i]
plot(year,depth, xlab=Year,
ylab=Depth(m),main=expression(italic(paste(speciesName))) )
Unfortunately,
Hi,
I may be missing an important design decision, but could you not have
only a single data.frame as an argument of your function? From your
example, it seems that the colour can be mapped to the fac1 variable
of data,
compareCats - function(data) {
require(ggplot2)
p - ggplot(data,
and there
last_plot() %+% test[-rem, ] # replot with new dataset
HTH,
baptiste
2009/10/6 baptiste auguie baptiste.aug...@googlemail.com:
Hi,
I may be missing an important design decision, but could you not have
only a single data.frame as an argument of your function? From your
example, it seems
Hi,
2009/10/6 John Kane jrkrid...@yahoo.ca:
How do I suppress the numbers on the x-axis?
Try this,
p + opts(axis.text.x = theme_blank())
HTH,
baptiste
Thanks
__
[[elided Yahoo spam]]
very much.
--- On Tue, 10/6/09, baptiste auguie baptiste.aug...@googlemail.com wrote:
From: baptiste auguie baptiste.aug...@googlemail.com
Subject: Re: [R] ggplot equivalent of par(xaxt)
To: John Kane jrkrid...@yahoo.ca
Cc: R R-help r-h...@stat.math.ethz.ch
Received: Tuesday, October 6
Hi,
Whether or not what follows is to be recommended I don't know, but it
seems to work,
p - ggplot(diamonds, aes(carat, ..density..)) +
geom_histogram(binwidth = 0.2)
x = quote(cut)
facets = facet_grid(as.formula(bquote(.~.(x
p + facets
HTH,
baptiste
2009/10/5 Bryan Hanson
Now why do I always come up with a twisted bquote() where a simple
paste() would do!
Thanks,
baptiste
2009/10/5 hadley wickham h.wick...@gmail.com:
Whether or not what follows is to be recommended I don't know, but it
seems to work,
p - ggplot(diamonds, aes(carat, ..density..)) +
Hi,
Try this,
dev.new()
layout(matrix(1:4,2, by=T))
plot(1:10,main=top left plot)
plot(1:10,main=top right plot)
plot(1:10,main=bottom left plot)
plot(1:10,main=bottom right plot)
for (ii in 1:2){
for (jj in 1:2){
par(mfg=c(ii,jj))
text(5,2, lab=paste(plot #:,ii,,,jj,sep=))
}
}
par(mfg=c(1,1))
for simple ones.
Best regards,
baptiste
2009/10/4 baptiste auguie baptiste.aug...@googlemail.com:
Hi,
Try this,
dev.new()
layout(matrix(1:4,2, by=T))
plot(1:10,main=top left plot)
plot(1:10,main=top right plot)
plot(1:10,main=bottom left plot)
plot(1:10,main=bottom right plot
Hi,
You cannot start with a * in expression(). Try this,
plot(x~y,ylab=expression(~degree~C))
or even, as a short-cut,
plot(x~y,ylab=~degree~C)
HTH,
baptiste
2009/10/2 e-letter inp...@gmail.com:
Readers,
I have tried to use a plotmath command to add the temperature degree
sign (i.e. ᵒ
Hi,
It looks like lattice or ggplot2 might make this easier, but I'm not
entirely sure I understood the problem, short of an example.
Best,
baptiste
2009/10/2 Duncan Murdoch murd...@stats.uwo.ca:
On 02/10/2009 4:07 AM, Ben Kenward wrote:
Hi,
Is there a way to set the scale of a plot (i.e.
try this,
plot(x~y,ylab=expression(~degree~C),xlab=expression(x[2]~%))
baptiste
2009/10/2 e-letter inp...@gmail.com:
Readers,
I am unable to plot a label consisting of both subscript text and
percentage (%) symbol:
x-(1:10)
y-(200:191)
)
fun
}
foo = function(x, a=1){
x
}
sugar(foo)
sugar(foo, 'a')
sugar(sugar(foo))
sugar(foo, 'my.new.arg')
Best,
baptiste
2009/10/1 baptiste auguie baptiste.aug...@googlemail.com:
Dear list,
I have the following function,
sugar = function(fun, id = id){
ff - formals(fun)
if( id
Dear list,
I know I have seen this discussed before but I haven't been successful
in searching for ellipsis, dots, ... in the archives. I would
like to filter ... arguments according to their name, and dispatch
them to two sub-functions, say fun1 and fun2. I looked at lm() but it
seemed more
2009/10/1 Peter Ruckdeschel peter.ruckdesc...@web.de:
removed - c(lty,params.fun1)
## I assume you do not want to pass on argument lty...
dots.remaining - cl[-1] ### remove the function name
dots.remaining - dots.remaining[! names(dots.remaining)
%in%
Hi,
I know of three options that resemble your query,
- the roxygen package
- a ruby script called weeder by Hadley Wikham
- the inlinedocs package on r-forge
I only ever used roxygen though, so i can't speak for the relative
merits of the others.
HTH,
baptiste
2009/10/1 Steve Lianoglou
Dear list,
I have the following function,
sugar = function(fun, id = id){
ff - formals(fun)
if( id %in% names(ff))
stop(id is part of args(fun))
formals(fun) - c(unlist(ff), alist(id=))
fun
}
which one may use on a function foo,
foo = function(x){
x
}
sugar(foo) # results in the
2009/9/30 lith minil...@gmail.com:
Yes. You can get back the tick marks with scaless$col:
Thanks for the hint. May I kindly ask what would be the easiest way to
draw a line on the left side?
Try this,
mpanel = function(...) { grid.segments(0,0,0,1) ; panel.bwplot(...) }
bwplot(y~x,
the code for colour and fill
regular expressions...
baptiste
2009/9/28 baptiste auguie baptiste.aug...@googlemail.com:
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
Hi,
assuming v is sorted, try this,
v[ findInterval(x,v)+0:1 ]
see ?findInterval and perhaps ?cut
HTH,
baptiste
2009/9/30 Corrado ct...@york.ac.uk:
Dear list,
I have a strange requirement I have a vector, for example v-
c(0,0,0,0,1,2,4,6,8,8,8,8). I have a value,for example x-
Hi,
Try opening and closing the device outside the loop,
pdf(D:/research/plot.pdf)
for (i in 1:n) {
plot(mon, mu, type ='o')
}
dev.off()
HTH,
baptiste
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do
Hi,
I guess you want ?assign
See also this page for a working example,
http://wiki.r-project.org/rwiki/doku.php?id=guides:assigning-variable-names
HTH,
baptiste
2009/9/29 David Young dyo...@telefonica.net:
Hello All,
I'm a new R user and have a question about what in SAS would be called
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,
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
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,
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)
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,
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
301 - 400 of 724 matches
Mail list logo