Murdoch [mailto:murd...@stats.uwo.ca]
Inviato: gio 23/04/2009 14.21
A: mau...@alice.it
Cc: baptiste auguie; r-help Help
Oggetto: Re: [R] R: R: how to split and handle a big R program into
multiple files
On 4/23/2009 7:15 AM, mau...@alice.it wrote:
I read the on-line documentation.
What I am
on suitable devices, you could consider transparency,
plot(f,col=alpha(grey,0.8),pch=19)
baptiste
On 24 Apr 2009, at 14:09, Knut Krueger wrote:
f- data.frame(x=c(1,3,5,6,1),y=c(1,2,3,4,1))
plot(f)
__
R-help@r-project.org mailing list
Hi,
Have you considered using high-level plotting functions provided by
the ggplot2 or lattice package? Here's a dummy example,
x - seq(0, 10, length=100)
y1 - sin(x)
y2 - cos(x)
y3 - x^2/100
y4 - 1/x
d - data.frame(x, y1, y2, y3, y4)
library(reshape)
dm - melt(d, id=x)
dm$type1 -
Hi,
You could do this very easily using ggplot2,
#install.packages(ggplot2, dep=TRUE)
library(ggplot2)
c - ggplot(mtcars, aes(y=wt, x=mpg)) + facet_grid(. ~ cyl)
c + stat_smooth(method=lm) + geom_point()
See more examples on Hadley's website: http://had.co.nz/ggplot2/
Hope this helps,
I'm not sure I'm following you but have you tried,
identical(matrix(c(1,1,1,1),ncol=2), matrix(c(1,1,1,1),ncol=2))
?all.equal
?isTRUE
?identical
and possibly the compare package,
compare(matrix(c(1,1,1,1),ncol=2),matrix(c(1,1,1,1),ncol=2))
HTH,
baptiste
On 26 Apr 2009, at 18:02, Esmail
matrix copy/shuffle/compares (Esmail)
14. Re: Conditional plot labels (baptiste auguie)
15. Re: Scatterplot of two groups side-by-side? (baptiste auguie)
16. Help to select the raw in a data.frame with the max value
(Alessandro)
17. re moving entries from one vector that are in another
Thanks Hadley, for some reason I didn't see your email until now. It
works fine with the development version,
library(plyr)
df - data.frame(a=1:10 , b=1:10)
foo1 - function(a, b, cc=0, d=0){
a + b + cc + d
}
mdply(data. = df, foo1, cc=1, d=2)
I think using . prefixes is a safer option
Dear list,
I've been trying this for a few hours and I just don't understand how
lattice works with groups and subscripts.
Consider the following example,
xx - seq(1, 10, length=100)
x - rep(xx, 4)
y - c(cos(xx), sin(xx), xx, xx^2/10)
fact - factor(rep(c(cos, sin, id, square),
Hi, and thanks for your email,
I realise my example was not very good. The actual dataset I'm trying
to plot is rather big and this oversimplified example did not make
much sense.
I actually do need to color different subsets of the data differently
in each panel, that's why I thought of
Many thanks, I think I got the spirit of 'capturing and overriding'
the arguments which was the bit i was missing. It's much clearer now
with a working example.
Thanks again,
baptiste
On 7 Oct 2008, at 21:19, Deepayan Sarkar wrote:
On Tue, Oct 7, 2008 at 8:54 AM, baptiste auguie [EMAIL
It worked for me, do you have the latest version of ggplot2 released a
few days ago (ggplot2_0.7) ?
Baptiste
On 9 Oct 2008, at 20:55, stephen sefick wrote:
Error in `[.data.frame`(df, , var) : undefined columns selected
I got this error in a fresh R session after rerunning all of the
Hi
it might be as simple as adding type = b in your call, however if
you need more help you'll have to provide a reproducible example and
explain what package you used (I think several packages define a
plotCI function).
Hope this helps,
Baptiste
On 10 Oct 2008, at 22:15, Caio Azevedo
Hi,
I believe you want to look at ?strip.custom
someStuff - data.frame(area = rep(c(SOUTH, NORTH, EAST,
WEST), each
= 25),
group = rep(c(A,B,C,D), each = 5),
mytime = rep(1:4),
val1 = sample(1:100, size=100, replace=TRUE),
val2 =
Hi,
I use Textmate, but every now and then I like to try out aquamacs.
I've just downloaded it from http://aquamacs.org/ , where ESS is
part of the package. It runs flawlessly for me, out of the box. I just
opened a r file, clicked the big R icon, then simply highlighted part
of the code
Hi,
I feel that your example isn't exactly minimal so I may be completely
overlooking your question. Would the following do?
library(lattice)
mdf - data.frame(x - seq(0, pi, l=100), y=sin(x))
xyplot(y~x, data=mdf, type=b,
par.settings=list(plot.symbol=list(pch=21, col=red,
Dear list,
I've generated a list of 3D coordinates representing ellipsoids in
arbitrary orientations. I'm now trying to obtain a 2D projection of
the scene, that is to draw the silhouette of each object on a plane
(x,y). The only way I could think of is to compute the convex hull of
the
Dear all,
I wrote a wrapper to a FORTRAN program using R. The main program uses
a text file (~200 lines) as an input describing the simulation to be
run. I typically generate the file once with the right parameters
using a combination of file(), paste(), cat(). This is fine, and it
more natural to create and manipulate all the
strings in R and write the new file every time in a single step.
Thanks,
baptiste
On 27 Oct 2008, at 10:47, Duncan Murdoch wrote:
baptiste auguie wrote:
Dear all,
I wrote a wrapper to a FORTRAN program using R. The main program uses
a text
Hi,
You could use the grid package to place treillis objects in any custom
layout you want, for example
(inspired by Paul Murrell's R graphics book http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html
fig 5.22),
library(grid)
library(lattice)
df - data.frame(x=rnorm(100),
Hi,
I believe you could use plot.window(xlim,ylim,...), followed by par().
In any case, the code of plot.default should inspire you (note that
it's calling plot.new(), for instance).
Baptiste
On 30 Oct 2008, at 09:32, Johannes Graumann wrote:
Hello,
Is it possible to get all par
Hi,
I believe you can apply the same procedure as described in Paul
Murrell's R graphics book for arranging lattice plots.
library(grid)
library(ggplot2)
?grid.layout
df - data.frame(x=rnorm(100), y=rnorm(100))
df2 - data.frame(x - rnorm(100), y=runif(x))
p - qplot(x,y, data=df)
p2 -
perhaps you could also look into ggplot2 or lattice package to display
several plots on the same page.
They take care of important but annoying details such as scaling,
layout, limits, legend, ... Admittedly, there is a learning curve when
you're used to base graphics, but in the long term
perhaps something like,
func - function(f, ...) {
do.call(f, ...)
}
func(rnorm, list(n=3, mean=2, sd=3))
baptiste
On 7 Nov 2008, at 10:21, [EMAIL PROTECTED] wrote:
How can I apply function f, that I get as an argument as in
func - function(f, ...) {
.
.
.
}
to a list of arguments
Dear all,
I'm writing a code that requires Bessel functions with complex argument.
Searching the list, I found the continuation of a thread I initiated a few
months ago:
http://tolstoy.newcastle.edu.au/R/e4/devel/08/03/0746.html
As I understand, the most promising option would be to use the
you may want to look into Hadley's new package plyr for this kind of
operation.
baptiste
On 12 Nov 2008, at 17:51, Stavros Macrakis wrote:
By-the-way^2: is there some Xapply function that maps a function over
all the elements of a structure (vector, matrix, list, ...) and
preserves the
Hi,
Your idea reminds me of an example in the documentation of the brew package,
featuring the generation of a template. You might want to check it out.
baptiste
On Wed, Nov 12, 2008 at 2:01 PM, Kem Phillips [EMAIL PROTECTED]wrote:
Dirk,
I came upon your message below in searching for a
Hi,
I think the following code should do what you want,
xyplot(yvar~year|week,data=df,layout = c(4, 5),
type='p',
groups = temp ,
panel = function(x, y, ...) {
panel.superpose(x, y,
Dear list,
My favorite output format is usually pdf. I can include the graphics
in pdflatex documents and benefit from the scalable nature of vector
graphic formats.
However, I recently had to generate high-res 2D levelplot graphics as
in the example below,
N - 100
# N - 1000 # slow to
Thanks for your comment. I would typically follow this approach too,
but I'm wondering whether one could find a more sophisticated
solution. Ideally, I'd like to be able to select the text that is
annotating the figure. There are very few cases where I can see a real
need for raster text,
Hi,
you are feeding lapply i as an optional argument, which is passed to
fn() and causes an error. Just use lapply(1:4, fn), or better yet,
sapply,
fn - function(i) return(i^2)
sapply(1:4, fn)
[1] 1 4 9 16
Hope this helps,
baptiste
On 20 Nov 2008, at 16:31, megh wrote:
I have
Dear list,
I'm trying to get two lattice plots aligned on a page. They should
share a common x axis, hence the need for perfect alignment, but the
data is taken from unrelated, separate sources (it is therefore
inappropriate to combine them and use facetting to get an automatic
layout:
Just a thought on this topic, I found Harminv quite powerful for this
sort of task. I wonder whether it could be wrapped into a R package
(it's GPL).
http://ab-initio.mit.edu/wiki/index.php/Harminv
On 20 Nov 2008, at 22:46, Prof Brian Ripley wrote:
See e.g.
code.
Baptiste
On 9 Nov 2008, at 12:22, baptiste auguie wrote:
Dear all,
I'm writing a code that requires Bessel functions with complex
argument.
Searching the list, I found the continuation of a thread I initiated
a few
months ago:
http://tolstoy.newcastle.edu.au/R/e4/devel/08/03
Have you tried c() from the latticeExtra package?
It worked for me (see below)
library(grid)
library(lattice)
x - seq(0, 10, length=100)
y - sin(x)
y2 - 10*sin(x)
f - rep(c(1, 2), each=50)
p1 - xyplot(y~x,groups=f, ylab=BIG LABEL,
# auto.key=list(space=right),
par.settings =
I guess by workspace you mean global environment. I believe this is
generally considered a bad practice, but see ?assign and ?-
baptiste
On 27 Jan 2009, at 13:54, diego Diego wrote:
Hello experts!
Is there a way to send an internal variable from a function to the
workspace, besides the
Try this:
plot(1:20)
axis(3, at=seq(0,20), label=FALSE)
A better description of your plot would be useful if ?axis is not
enough to help you out.
hope this helps,
baptiste
On 27 Jan 2009, at 14:13, mau...@alice.it wrote:
Is there a way to force the number of ticks along an axis ?
I
Hi,
If all else fails, you could consider using LaTeX itself with psfrag,
or perhaps a similar idea involving eps2pgf.
http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/PsFrag
Hope this helps,
baptiste
On 29 Jan 2009, at 11:24, Rau, Roland wrote:
Dear all,
I would like to plot the
Hi,
Perhaps this can help if you don't want to manually specify the
permutation of indices,
A=matrix(10,ncol=2,nrow=2)
B - 2*A
C - rbind(A, B)
C[ as.vector(t(matrix(seq(1,nrow(C)),ncol=2))), ] # trick to create
the vector of permutations
[,1] [,2]
[1,] 10 10
[2,] 20 20
Another option,
library(ggplot2)
qplot(year, value, data=melt(foo), color= L1)
which can also be achieved by hand,
test- do.call(rbind,foo) # combines all data.sets
test$name - do.call(rep, list(x=names(foo), times =
unlist(lapply(foo,nrow # append the name of the original dataset
I don't know about the maptools package but 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.
Hope this helps,
baptiste
On 5 Feb 2009, at 13:21, Aleksandr Andreev wrote:
In R's maptools package,
Perhaps this is what was intended?
sims - list(length=100)
do.call(seq, sims)
seq by itself does not expect a list, but do.call() can create the
appropriate call if a list is what you want to pass to the function.
Hope this helps,
baptiste
On 5 Feb 2009, at 19:46, Uwe Ligges wrote:
Dear list,
This is quite a specific question requiring the package orthopolynom.
This package provides a nice implementation of the Legendre
polynomials, however I need the associated Legendre polynomial which
can be readily expressed in terms of the mth order derivative of the
A powerful scheme for harmonic inversion of time signals known as
filter diagonalization method is available from MIT: http://ab-initio.mit.edu/wiki/index.php/Harminv
I don't know of any R interface, but it might be a good option for
your problem.
Cheers,
baptiste
On 10 Feb 2009, at
In a different perspective the sage project might also be an option,
it seems to interface to Maxima and R among other things. I haven't
tested it myself though.
http://www.sagemath.org/index.html
Best wishes,
baptiste
PS: sagemath.org is a well-thought website, perhaps a good
A somewhat twisted approach that has not been mentioned is to consider
everything a comment unless it is enclosed in special tags, as done in
the brew package,
for example,
brew(textConnection(
You won't see this R output, but it will run. % foo - 'bar' %
Now foo is %=foo% and today is
On 11 Feb 2009, at 13:41, Gustaf Rydevik wrote:
On Wed, Feb 11, 2009 at 2:15 PM, baptiste auguie
ba...@exeter.ac.uk wrote:
A somewhat twisted approach that has not been mentioned is to
consider
everything a comment unless it is enclosed in special tags, as done
in the
brew package
lattice and ggplot2 also offer a general way of doing this,
# first create a data.frame in the long format containing the two
data sets
x1 - seq(-10, 10)
x2 - seq(-8, 12)
y1 - sin(x1/3)
y2 - cos(x2/2)
d1 - data.frame(x=x1, y=y1, var=1)
d2 - data.frame(x=x2, y=y2, var=2)
library(reshape)
d -
Hi,
I think Reduce could help you.
DF1 - data.frame(var1 = letters[1:5], a = rnorm(5))
DF2 - data.frame(var1 = letters[3:7], b = rnorm(5))
DF3 - data.frame(var1 = letters[6:10], c = rnorm(5))
DF4 - data.frame(var1 = letters[8:12], d = rnorm(5))
g - merge(DF1, DF2, by.x=var1, by.y=var1, all=T)
Another option using Recall,
merge.rec - function(.list, ...){
if(length(.list)==1) return(.list[[1]])
Recall(c(list(merge(.list[[1]], .list[[2]], ...)), .list[-(1:2)]), ...)
}
my.list - list(DF1, DF2, DF3, DF4)
test2 - merge.rec(my.list, by.x=var1, by.y=var1, all=T)
(clabs, names(xi)) :
names do not match previous names
- Lauri
2009/2/19 baptiste auguie ba...@exeter.ac.uk:
Hi,
I think Reduce could help you.
DF1 - data.frame(var1 = letters[1:5], a = rnorm(5))
DF2 - data.frame(var1 = letters[3:7], b = rnorm(5))
DF3 - data.frame(var1 = letters[6:10], c
Perhaps you can try this,
d - c(0.00377467, 0.00377467, 0.00377467, 0.00380083,
0.00380083, 0.00380083,
0.00380959, 0.00380959, 0.00380959, 0.00380083, 0.00380083,
0.00380083)
c( t( cbind(matrix(d, ncol=3, byrow=T), 0)))
I don't know how to avoid the transpose operation that
thanks all for the correction, funny how it's often the complicated
solution that comes to mind first.
baptiste
On 19 Feb 2009, at 13:41, Eik Vettorazzi wrote:
actually
c(rbind(0,matrix(d, nrow=3)))
which has the bonus of giving the desired result ;)
baptiste auguie schrieb:
Perhaps
Another approach using latticeExtra, more ggplot2-like:
p - xyplot(matter~year|plot,type=l)
p +
latticeExtra::layer(panel.abline(v=1995))
On 20 Feb 2009, at 09:34, Chris Bennett wrote:
Hi,
I want to add a dashed vertical line to a number of xyplots.
Here is a simple script of the type
Hi, try this:
p - xyplot(matter~year|plot,type=l)
update(p, panel=function(...){
panel.xyplot(...)
panel.abline(v=1995)
} )
On 20 Feb 2009, at 09:34, Chris Bennett wrote:
Hi,
I want to add a dashed vertical line to a number of xyplots.
Here is a simple script of the
Hi,
something like this perhaps,
create_string - function(.s){
result - read.table(textConnection(.s))
sapply(result, as.character)
}
(test - create_string(ab cd ef))
hope this helps
baptiste
On 20 Feb 2009, at 16:38, Sean Zhang wrote:
My dear R-helpers:
I am a novice in
Paul Murrell's book provides such an example using Grid (figure 5.22).
A short example is available on his website:
http://www.stat.auckland.ac.nz/~paul/grid/doc/moveline.pdf
It may be possible to use this in conjunction with gridBase.
baptiste
On 22 Feb 2009, at 20:43, Eik Vettorazzi
Hi,
I got this problem once, and Prof. Ripley kindly added an example in
the help page of ?cut,
aaa - c(1,2,3,4,5,2,3,4,5,6,7)
## one way to extract the breakpoints
labs - levels(cut(aaa, 3))
cbind(lower = as.numeric( sub(\\((.+),.*, \\1, labs) ),
upper = as.numeric(
Hi,
Perhaps Hadley's plyr package can help,
library(plyr)
temp - list(x=2,y=3,x=4)
llply(temp, function(x) x^2 )
$x
[1] 4
$y
[1] 9
$x
[1] 16
baptiste
On 27 Feb 2009, at 03:07, Alexy Khrabrov wrote:
Sometimes I'm iterating over a list where names are keys into another
data structure,
Hi,
you probably want to use ?all.equal instead of ==
I couldn't run your example, though
Hope this helps,
baptiste
On 27 Feb 2009, at 10:32, Peterko wrote:
hi i am creating some variables from same data, but somewhere is
different
rouding.
look:
P = abs(fft(d.zlato)/480)^2
hladane=
Hi,
you could do one of the following,
1) combine a, b, c, d, e in a list and use ?lapply
my.list - list(a,b,c,d,e)
lapply(my.list, foo)
where foo() is a function to be applied to each individual element
2) alternatively, see ?get to retrieve the value of a variable from
its name. Your
If you have many such repetitions it can be annoying to type the
rbind(cbind ... sequence. Perhaps this would help,
m - read.table(textConnection(
IndividualsValue
A3
B4
C5
D2), head=T)
data.frame(groups= rep(c(group1, group2, group3),
each=nrow(m)), Ind=m[, 1],
What's wrong with geom_text?
my.value = 0.65
qplot(1,1)+geom_hline(v=0)+
geom_text(mapping=aes(x=1,y=0),label=paste(my.value),vjust=-1)
baptiste
On 3 Mar 2009, at 18:10, Dave Murray-Rust wrote:
Hello,
I'm using geom_hline to add a minimum line to my plot (representing
the best
sure Hadley will come up with a better explanation.
Best,
baptiste
On 3 Mar 2009, at 19:51, Dave Murray-Rust wrote:
On 3 Mar 2009, at 18:41, baptiste auguie wrote:
What's wrong with geom_text?
my.value = 0.65
qplot(1,1)+geom_hline(v=0)+
geom_text(mapping=aes(x=1,y=0),label=paste
Dear list,
I'd like to ask for some advice in creating a wrapper function for
this C code,
http://www.fourmilab.ch/documents/specrend/
http://www.fourmilab.ch/documents/specrend/specrend.c
I could probably port it in R, but I've been hoping to use compiled
code for a while and this looks
Hi,
Try:
polygon(c(x1, rev(x2)), c(y1, rev(y2)), col=grey)
In general you might need to make sure the data is well ordered.
Hope this helps,
baptiste
On 8 Mar 2009, at 16:52, Martin Batholdy wrote:
hi,
the code below produces me two curved lines.
Now I want to fill the space
Hi,
You could use the reshape package:
d$e - e
recast(d, variable~e, fun=sum)
The doBy package is another option.
baptiste
On 8 Mar 2009, at 17:14, soeren.vo...@eawag.ch wrote:
A dataframe holds 3 vars, each checked true or false (1, 0). Another
var holds the grouping, r and s:
###
Hi,
Try this:
DF1 - data.frame(var1 = letters[1:5], x = rnorm(5), y =2)
DF2 - data.frame(var1 = letters[3:7], x = rnorm(5), y=3)
DF3 - data.frame(var1 = letters[6:10], x = rnorm(5), y=0)
# ... DF10 if you wish
( result - merge_all(list(DF1, DF2, DF3) ))
save( result, file =merged.rda)
I
0.9774042 -1.387224
d 0.6459462 0.46152 31
1.3345912 0.645946
e 0.0587832 -0.2531231
0.6316762 0.058783
baptiste auguie-2 wrote:
Hi,
Try this:
DF1 - data.frame(var1
Hi,
On 9 Mar 2009, at 15:32, Sean Zhang wrote:
Dear R-helpers:
I am an R newbie and have a question related to writing functions that
accept unlimited number of input arguments.
it's usually through the ... argument, e.g in paste(...).
(I tried to peek into functions such as paste and
:50 AM, baptiste auguie
ba...@exeter.ac.uk wrote:
Hi,
On 9 Mar 2009, at 15:32, Sean Zhang wrote:
Dear R-helpers:
I am an R newbie and have a question related to writing functions
that
accept unlimited number of input arguments.
it's usually through the ... argument, e.g in paste
try
?paste
baptiste
On 10 Mar 2009, at 20:01, ig2ar-s...@yahoo.co.uk wrote:
Hi again R-ists,
How do you construct a string that you can pass to system()?
For instance. Say I do
system(echo Hello!)
Hello!
That works. Now the alternative: I need to construct the string like
this
a
I believe you can simply modify the panel function to replot the axes
on top with panel.axis(),
library(lattice)
model - function(a,b,c,d,e, f, X1,X2) # provide model function
# for contour plot
{J - a + (b*X1) + (c*X2) + (d*X1*X2) + e*(X1^2) + f*(X2^2)
pp - exp(J)/(1+exp(J))
Dear list,
I need to align two plots on top of each other for comparison (they
only have the x-axis in common). When the y-labels have a different
extent, I cannot find a way to align the x-axes, as illustrated below,
library(grid)
library(lattice)
x - seq(0, 10, length=100)
y - sin(x)
Hi,
The main difference I saw between your two graphs was the stacking,
which you can obtain by stack=TRUE in lattice. I'm not sure what
cosmetic issues you had in mind. Perhaps you can try this,
barchart(y~dfb|dfyr,dataf,layout=c(3,1),stack=T,ylim=c(0, 2.7),
groups=dfa, strip
Many thanks, this tool from latticeExtra does exactly what I was
trying to achieve!
Best wishes,
Baptiste
On 1 Dec 2008, at 20:06, Deepayan Sarkar wrote:
In general, the latticeExtra package has some tools to combine
arbitrary trellis objects (thanks to Felix Andrews):
Dear list,
I've written a small utility function to add arbitrary legend(s) to a
lattice graph (or a combination of them), much like the legend
function of base graphics. I though perhaps it could be useful to
someone else, or improved by suggestions. I understand this goes
against the
A few personal thoughts on this:
I recently joined a newly created R user group on google http://groups.google.co.uk/group/gur-ugr
that started with a similar impulse.
In my personal opinion, I see little overall benefit from such an
approach. For one thing, a major strength of the R
Hi,
font should be an integer as described in ?par. I think you want to
play with cex.main (possibly cex in combination, depending on what
your are plotting)
x - seq(0, 10)
pdf(width=8, height=20)
par(mfrow=c(45, 8), mai=c(0,0.1,0.1,0))
sapply(1:(45*8), function(ii) {
plot(x,
Dear list,
I have a data.frame with x, y values and a 3-level factor group,
say. I want to create a new column in this data.frame with the values
of y scaled to 1 by group. Perhaps the example below describes it best:
x - seq(0, 10, len=100)
my.df - data.frame(x = rep(x, 3), y=c(3*sin(x),
Excellent! I completely forgot its name and existence. Perhaps ave
should be mentioned on the help page of either by, tapply, split.
Many thanks,
baptiste
On 10 Dec 2008, at 17:20, Chuck Cleland wrote:
On 12/10/2008 12:02 PM, baptiste auguie wrote:
Dear list,
I have a data.frame with x
On 10 Dec 2008, at 17:25, hadley wickham wrote:
On Wed, Dec 10, 2008 at 11:02 AM, baptiste auguie
[EMAIL PROTECTED] wrote:
Dear list,
I have a data.frame with x, y values and a 3-level factor group,
say. I
want to create a new column in this data.frame with the values of y
scaled
to 1
From the code of legend() the length seems to be hard-wired (seg.len
= 2). You could copy the code and add this seg.len as a free
parameter in your own custom function. An alternative is to use the
lattice package which has a size argument for this purpose. See ?
xyplot in the key section.
Hi,
Good idea, what do you say we try and write a page on this in the R
wiki?
I started the topic:
http://wiki.r-project.org/rwiki/doku.php?id=guides:overview-data-manip
Once the content is there, it wouldn't be much of an effort to create
a reference-card format if required.
Best
Hi,
Perhaps you can use expand.grid and then remove the mirror combinations,
values - 1:3
tmp - expand.grid(values, values)
unique.combs - tmp[tmp[, 1]=tmp[, 2], ]
unique.combs[do.call(order, unique.combs), ] # reorder if you wish
Var1 Var2
111
412
713
522
8
have you tried do.call(rbind, aa) , or perhaps do.call(merge, aa) ?
Hope this helps,
baptiste
On 15 Dec 2008, at 13:23, 江文恺 wrote:
Dear all:
I have a list of dataframes like this, i try to merge this lists of
dataframes into one single dataframe, and keep ther column names as
usual,
I wrote a dirty hack last time I faced this problem, I'll be curious
to see what is the proper way of dealing with the scoping and
evaluation rules.
library(datasets)
myfunction-function(table, extraction) {
table2-subset(table,extraction)
return(table2)
}
condition1 -
I thought this was a good candidate for the plyr package, but it seems
that l*ply functions are meant to operate only on separate list
elements:
Lists are the simplest type of input to deal with because they are
already naturally
divided into pieces: the elements of the list. For this
wickham wrote:
On Tue, Dec 30, 2008 at 10:21 AM, baptiste auguie
ba...@exeter.ac.uk wrote:
I thought this was a good candidate for the plyr package, but it
seems that
l*ply functions are meant to operate only on separate list elements:
Lists are the simplest type of input to deal with because
Grothendieck
ggrothendi...@gmail.com wrote:
Try:
do.call(abind, c(foo, along = 3))
On Tue, Dec 30, 2008 at 1:15 PM, baptiste auguie
ba...@exeter.ac.uk wrote:
In fact, when writing my post I tried to do exactly what you did
in creating
a 3d array from the list, and I failed miserably
That's really a scilab question, nothing to do with R as far as I can
see. Moreover, you haven't provided any of the information requested
in the posting guide (OS, example, ...).
i'm guessing that something along those lines should work,
system(scilab -nw -f yourscript.sce)
that is,
Dear list,
I'm having second thoughts after solving a very trivial problem: I
want to extend the relevel() function to reorder an arbitrary number
of levels of a factor in one go. I could not find a trivial way of
using the code obtained by getS3method(relevel,factor). Instead, I
thought
in relevel() in the first place.
Perhaps such a small modification could be useful, at least in the
documentation?
Thanks,
baptiste
baptiste auguie wrote:
Dear list,
I'm having second thoughts after solving a very trivial problem: I
want
to extend the relevel() function to reorder
] Namens baptiste auguie
Verzonden: vrijdag 9 januari 2009 15:11
Aan: R R-help
Onderwerp: [R] recursive relevel
Dear list,
I'm having second thoughts after solving a very trivial problem: I
want to extend the relevel() function to reorder an arbitrary number
of levels of a factor in one go. I could
you can also look at subset,
my.data.frame - data.frame(a=rnorm(10),
b=factor(sample(letters[1:4], 10, replace=T)))
str(my.data.frame)
my.data.frame[my.data.frame$b == a, ]
subset(my.data.frame, b == a)
by the way, it is probably safer not to use data as a variable
Hi,
I think this is a very common question on this list. I've just created
a page in the R wiki (inspired by https://stat.ethz.ch/pipermail/r-help/2007-May/132466.html)
. With some suggestions and improvements, hopefully we can make a good
reference for others to refer to in the future:
Your dummy data is not a reproducible example. I'm guessing ?unique
could help you.
Hope this helps,
baptiste
On 14 Jan 2009, at 13:19, glenn wrote:
For a list say;
list1-{1,2,3,4,5,2,1}
How do I remove the duplicates please?
My real list is 20,000 obs long of dates with many duplicates
Dear list,
This is a bit of an off-topic question, but I'm hoping to get some
advice from more experienced people. I've used the website Web of
Science to manually collect publication counts responding to several
keywords as a function of date, since the 1960s.
it is trivial to create such a string with the desired keyword
and dates, and retrieve the number of results using readLines(url) and
grep.
Thanks to Phil Spector for some pointers.
Best wishes,
baptiste
On 14 Jan 2009, at 13:44, baptiste auguie wrote:
Dear list,
This is a bit of an off-topic
, but not
single out the value which lies between b10/b of about
b21,900/b for bbphotonics/b .
Any regexp guru to help me out? I've never got my head around these,
other than trivial cases.
Many thanks,
baptiste
On 15 Jan 2009, at 09:45, baptiste auguie wrote:
For the record, I thought
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
401 - 500 of 724 matches
Mail list logo