Hi,
I think you want to Vectorize integrate(), not integrand(). Here's a
way using mapply,
integrand - function(z)
{
return(z * z)
}
vec1-1:3
vec2-2:4
mapply(integrate, lower=vec1, upper=vec2, MoreArgs=list(f=integrand) )
baptiste
On 20 Sep 2008, at 13:08, Andreas Wittmann wrote:
I had a similar problem recently where I used the following code:
v - factor(letters[1:3])
all.cases - expand.grid(v, v)
all.cases[as.numeric(all.cases[, 2]) = as.numeric(all.cases[, 1]), ]
I'm not sure how to extend it cleanly to an arbitrary number of
vectors, though.
Baptiste
On 31
Hi,
I'm not sure I understand what you want, but perhaps:
x - 1:9
y - x
plot(x, y, ann=F, xaxt=n)
axis(1, lab=F) - positions
mtext(paste(positions), side = 1, line = 1, outer = F, at = test,
cex=1:length(positions))
HTH,
baptiste
On 27 Aug 2008, at 18:36, Dani Valverde wrote:
Hello,
Whoops, typo in my previous post:
x - 1:10
y - x
plot(x, y, ann=F, xaxt=n)
axis(1, lab=F) - positions
mtext(paste(positions), side = 1, line = 1, outer = F, at = positions,
cex=seq(1, 9, length=length(positions)))
Is this what you mean by label sizes?
On 27 Aug 2008, at 18:51, baptiste
Dear all,
I'm routinely using lattice and ggplot2, I wish to create a lattice
theme that looks not too dissimilar to ggplot's defaults so I can
include both graphs in a document with a consistent look.
To illustrate my questions, consider the following example:
library(ggplot2)
Hi,
I find convenient to use a custom function for this:
sample.df -
function (df, N = 1000, ...)
{
df[sample(nrow(df), N, ...), ]
}
sample.df(daf1,1000)
Hope this helps,
baptiste
On 25 Aug 2008, at 12:31, Martin Hvidberg wrote:
I have a data frame (daf1), that holds +8
Hi
I think you want something like,
with(ds, tapply(yn, drank1group, rank) )
also, the reshape package should do this sort of thing neatly.
Hope this helps,
baptiste
On 25 Aug 2008, at 16:10, ivo welch wrote:
Dear R wizards: First, thanks for the notes on SQL. These pointers
will
Brilliant! I've just ordered your book to learn more about lattice as
its use is quite gripping despite a steep learning curve.
Many thanks,
baptiste
On 25 Aug 2008, at 23:07, Deepayan Sarkar wrote:
On Mon, Aug 25, 2008 at 4:47 AM, baptiste auguie
[EMAIL PROTECTED] wrote:
Dear all
Dear list,
I have the following example, from which I am hoping to retrieve
numeric values of the factor levels (that is, without the brackets):
x - seq(1, 15, length=100)
y - sin(x)
my.cuts - cut(which(abs(y) 1e-1), 3)
levels(my.cuts)
hist() does not suit me for this, as it does not
, look for zeros on both sides, etc... this
quickly makes a complicated decision tree when the number of zeros
grows and I could not find a clean way to implement it.
Any thoughts welcome! I feel like I've overlooked an obvious trick.
Many thanks,
baptiste
On 7 Aug 2008, at 11:49, baptiste
))
lims
}
cutIntervals(1:5, 3)
Many thanks,
baptiste
On 9 Aug 2008, at 11:12, Prof Brian Ripley wrote:
On Sat, 9 Aug 2008, baptiste auguie wrote:
Dear list,
I have the following example, from which I am hoping to retrieve
numeric values of the factor levels (that is, without the brackets
like I've overlooked an obvious trick.
Many thanks,
baptiste
On 7 Aug 2008, at 11:49, baptiste auguie wrote:
Dear list,
I've had this problem for a while and I'm looking for a more general
and robust technique than I've been able to imagine myself. I need
to find N (typically N= 3 to 5
of zeros
grows and I could not find a clean way to implement it.
Any thoughts welcome! I feel like I've overlooked an obvious trick.
Many thanks,
baptiste
On 7 Aug 2008, at 11:49, baptiste auguie wrote:
Dear list,
I've had this problem for a while and I'm looking for a more general
:[EMAIL PROTECTED]
] On
Behalf Of baptiste auguie
Sent: Friday, August 08, 2008 1:25 PM
To: Hans W. Borchers
Cc: r-help@r-project.org
Subject: Re: [R] re cursive root finding
On 8 Aug 2008, at 16:44, Hans W. Borchers wrote:
As your curve is defined by its points, I don't see any reason
Dear list,
I've had this problem for a while and I'm looking for a more general
and robust technique than I've been able to imagine myself. I need to
find N (typically N= 3 to 5) zeros in a function that is not a
polynomial in a specified interval.
The code below illustrates this, by
Hi list,
This is a very basic question about lattice: I wish to add some
vertical lines in each panel of a xyplot as demonstrated in this
example:
library(lattice)
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),
- data.frame(a=rnorm(10, 25), b=rnorm(10, 0))
p + geom_abline(aes(intercept=a, slope=b), data=df)
i get an error:
Error in `[.data.frame`(df, , var) : undefined columns selected
Thanks again,
baptiste
On 7 Aug 2008, at 20:04, Deepayan Sarkar wrote:
On Thu, Aug 7, 2008 at 11:54 AM, baptiste
It seems to me that the reshape package should do the job,
library(reshape) # note that you need to fix the method to melt lists
in the current version ( passing ... to the method for data.frames, as
discussed here last week)
cast(data=melt(dat), fun.aggregate = function(.x)
Dear list,
I'm writing a long document (thesis) and as much as I would like to
use only ggplot2 for the graphics, some features are still a bit
undocumented so I often end up choosing either ggplot2, lattice, or
base plots (which i know better) depending on the particular graph to
Here is my attempt at this (taking a specific understanding of the ill-
defined equivalence relation),
unletter - function(word){
word.broken - strsplit(word, NULL)
set.of.numbers - sapply(word.broken[[1]], function(let) which(let ==
letters))
paste(set.of.numbers,
, (Ted Harding) wrote:
On 28-Jul-08 09:29:22, baptiste auguie wrote:
Here is my attempt at this (taking a specific understanding of the
ill-
defined equivalence relation),
unletter - function(word){
word.broken - strsplit(word, NULL)
set.of.numbers - sapply(word.broken[[1]], function
On 26 Jul 2008, at 02:52, hadley wickham wrote:
On Fri, Jul 25, 2008 at 8:50 PM, hadley wickham
[EMAIL PROTECTED] wrote:
On Fri, Jul 25, 2008 at 9:49 AM, baptiste auguie
[EMAIL PROTECTED] wrote:
Dear list,
I'm trying to use the reshape package to perform a merging
operation on a
list
Dear list,
I'm trying to use the reshape package to perform a merging operation
on a list of data.frames as illustrated below,
a - 1:10
example - list( data.frame(a=a, b=sin(a)), data.frame(a=a,
b=cos(a)) )
melt(example, id = a)
this produces the desired result, where the
Given that I cannot arbitrarily change the data to make a an
integer, can I still use a as a grouping variable?
I tried melt(example, id = factor(a)) but it does not work either.
Must this change from numeric values to factors be done before
applying melt?
Thanks,
baptiste
On 25 Jul
701 - 724 of 724 matches
Mail list logo