On 11-05-17 01:15 PM, John Chambers wrote:
On 5/17/11 9:53 AM, Hervé Pagès wrote:
On 11-05-17 09:04 AM, John Chambers wrote:
One point that may have been unclear, though it's surprising if so. The
discussion was about assigning names to S4 objects from classes that do
NOT have a formal "names
On 5/17/11 9:53 AM, Hervé Pagès wrote:
On 11-05-17 09:04 AM, John Chambers wrote:
One point that may have been unclear, though it's surprising if so. The
discussion was about assigning names to S4 objects from classes that do
NOT have a formal "names" slot. Of course, having a "names" slot is
On 11-05-17 09:04 AM, John Chambers wrote:
One point that may have been unclear, though it's surprising if so. The
discussion was about assigning names to S4 objects from classes that do
NOT have a formal "names" slot. Of course, having a "names" slot is not
illegal, it's what one should do to de
One point that may have been unclear, though it's surprising if so. The
discussion was about assigning names to S4 objects from classes that do
NOT have a formal "names" slot. Of course, having a "names" slot is not
illegal, it's what one should do to deal with names in S4. Look at
class "na
On 11-05-16 04:13 PM, Hervé Pagès wrote:
On 11-05-16 01:53 PM, John Chambers wrote:
On 5/16/11 10:09 AM, Hervé Pagès wrote:
On 11-05-16 09:36 AM, John Chambers wrote:
You set up a names slot in a non-vector. Maybe that should be allowed,
maybe not. But in any case I would not expect the name
On 11-05-16 01:53 PM, John Chambers wrote:
On 5/16/11 10:09 AM, Hervé Pagès wrote:
On 11-05-16 09:36 AM, John Chambers wrote:
You set up a names slot in a non-vector. Maybe that should be allowed,
maybe not. But in any case I would not expect the names() primitive to
find it, because your obj
On 5/16/11 10:09 AM, Hervé Pagès wrote:
On 11-05-16 09:36 AM, John Chambers wrote:
You set up a names slot in a non-vector. Maybe that should be allowed,
maybe not. But in any case I would not expect the names() primitive to
find it, because your object has a non-vector type ("S4").
But the
On 11-05-16 09:36 AM, John Chambers wrote:
You set up a names slot in a non-vector. Maybe that should be allowed,
maybe not. But in any case I would not expect the names() primitive to
find it, because your object has a non-vector type ("S4").
But the names<-() primitive *does* find it. So eith
You set up a names slot in a non-vector. Maybe that should be allowed,
maybe not. But in any case I would not expect the names() primitive to
find it, because your object has a non-vector type ("S4"). You could do
a@names if you thought that made sense:
> setClass("A", representation(names
On 11-05-15 11:33 AM, John Chambers wrote:
This is basically a case of a user error that is not being caught:
Sure!
https://stat.ethz.ch/pipermail/r-devel/2009-March/052386.html
On 5/14/11 3:47 PM, Hervé Pagès wrote:
Hi,
I was stumped by this. The two S4 objects below looked exactly the
This is basically a case of a user error that is not being caught:
On 5/14/11 3:47 PM, Hervé Pagès wrote:
Hi,
I was stumped by this. The two S4 objects below looked exactly the same:
> a1
An object of class "A"
Slot "aa":
integer(0)
> a2
An object of class "A"
Slot "aa":
integer(0)
> str(a
Hi,
I was stumped by this. The two S4 objects below looked exactly the same:
> a1
An object of class "A"
Slot "aa":
integer(0)
> a2
An object of class "A"
Slot "aa":
integer(0)
> str(a1)
Formal class 'A' [package ".GlobalEnv"] with 1 slots
..@ aa: int(0)
> str(a2)
Fo
I've played a bit with the problem that Jeff Laake
reported on R-help:
# create data:
jl <- data.frame(x=rep(1, 3), y=tapply(1:9, rep(c('A','B','C'), each=3),
sum))
jl2 <- jl
jl2$y <- as.numeric(jl2$y)
# do the test:
> tapply(jl$y, jl$x, length)
1
3
> tapply(jl2$y, jl2$x, length)
1
3
> by(jl
>- Oorspronkelijk bericht -
>Van: Peter Dalgaard [mailto:[EMAIL PROTECTED]
>Verzonden: donderdag, april 3, 2008 02:16 PM
>Aan: 'Tobias Verbeke'
>CC: r-devel@r-project.org
>Onderwerp: Re: [Rd] by "infelicity"
>
>Tobias Verbeke wrote:
>> De
Tobias Verbeke wrote:
> Dear list,
>
> Please find below an example of odd
> behaviour of the by function.
>
> It occurs both under GNU/Linux R 2.6.2
> and Windows R 2.7.0alpha. Respective
> sessionInfo()'s are given below.
>
> I hope I do not overlook anything.
>
> testFactor <- factor(sample(LET
Dear list,
Please find below an example of odd
behaviour of the by function.
It occurs both under GNU/Linux R 2.6.2
and Windows R 2.7.0alpha. Respective
sessionInfo()'s are given below.
I hope I do not overlook anything.
testFactor <- factor(sample(LETTERS[1:6], size = 42, replace = TRUE))
tes
Full_Name: Simon de Bernard
Version: 2.7.0 (44733)
OS: MacOS
Submission from: (NULL) (140.77.34.213)
"by" usually takes forever even on a "not so large" data structure.
If one can do with a matrix instead of a data.frame, defining by.matrix as
by.data.frame modified to convert data back to a dat
And here is one more approach using the reshape package:
library(reshape)
dataset.d <- melt(dataset, id = 1:2)
cast(dataset.d, gp1 + gp2 ~ variable, mean)
On 9/30/05, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
> Check out summaryBy in the doBy package at:
>
> http://genetics.agrsci.dk/~sor
On 9/30/2005 1:41 PM, hadley wickham wrote:
> I'm not entirely sure what you want, but maybe this does the trick?
>
> data.frame.by <- function(data, variables, fun, ...) {
> if (length(variables) == 0 ) {
> df <- data.frame(results = 0)
> df$results <- list(fun(d
On 9/30/2005 1:41 PM, Peter Dalgaard wrote:
> Duncan Murdoch <[EMAIL PROTECTED]> writes:
>
>> I want to calculate a statistic on a number of subgroups of a dataframe,
>> then put the results into a dataframe. (What SAS PROC MEANS does, I
>> think, though it's been years since I used it.)
>>
>>
On Fri, 2005-09-30 at 13:22 -0400, Duncan Murdoch wrote:
> I want to calculate a statistic on a number of subgroups of a dataframe,
> then put the results into a dataframe. (What SAS PROC MEANS does, I
> think, though it's been years since I used it.)
>
> This is possible using by(), but it see
Check out summaryBy in the doBy package at:
http://genetics.agrsci.dk/~sorenh/misc
e.g.
summaryBy(value ~ gp1 + gp2, data = dataset)
On 9/30/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
> I want to calculate a statistic on a number of subgroups of a dataframe,
> then put the results in
Duncan Murdoch <[EMAIL PROTECTED]> writes:
> I want to calculate a statistic on a number of subgroups of a dataframe,
> then put the results into a dataframe. (What SAS PROC MEANS does, I
> think, though it's been years since I used it.)
>
> This is possible using by(), but it seems cumbersome
I'm not entirely sure what you want, but maybe this does the trick?
data.frame.by <- function(data, variables, fun, ...) {
if (length(variables) == 0 ) {
df <- data.frame(results = 0)
df$results <- list(fun(data$value, ...))
return(df)
I want to calculate a statistic on a number of subgroups of a dataframe,
then put the results into a dataframe. (What SAS PROC MEANS does, I
think, though it's been years since I used it.)
This is possible using by(), but it seems cumbersome and fragile. Is
there a more straightforward way th
Full_Name: G. Grothendieck
Version: R version 2.1.0, 2005-06-10
OS: Windows XP
Submission from: (NULL) (216.59.226.184)
This is an inconsistency between by and similar functions.
The 'by' function should have an initial line of:
FUN <- match.fun(FUN)
All other similar functions including app
Gabor Grothendieck <[EMAIL PROTECTED]> writes:
> On 6/12/05, Simon Urbanek <[EMAIL PROTECTED]> wrote:
> > Umm.. why don't you just use
> >
> > by(iris, row.names(iris), `(`)
> >
> > In general I consider passing functions as text unnecessary - the
> > only use I could think of is constructi
On 6/12/05, Simon Urbanek <[EMAIL PROTECTED]> wrote:
> On Jun 12, 2005, at 3:21 PM, Gabor Grothendieck wrote:
>
> > On 6/12/05, Liaw, Andy <[EMAIL PROTECTED]> wrote:
> >
> >> I don't get the point. ?by says:
> >>
> >
> > The point is that all other functions of this sort including apply,
> > sapp
On Jun 12, 2005, at 3:21 PM, Gabor Grothendieck wrote:
> On 6/12/05, Liaw, Andy <[EMAIL PROTECTED]> wrote:
>
>> I don't get the point. ?by says:
>>
>
> The point is that all other functions of this sort including apply,
> sapply,
> tapply, lapply work like that so 'by' ought to as well.
>
> Her
On 6/12/05, Liaw, Andy <[EMAIL PROTECTED]> wrote:
> I don't get the point. ?by says:
The point is that all other functions of this sort including apply, sapply,
tapply, lapply work like that so 'by' ought to as well.
Here is the example (changed to use iris) where I noticed it. Suppose we
wa
I don't get the point. ?by says:
FUN a function to be applied to data frame subsets of data.
It doesn't say FUN can be a character, and by(iris, iris$Species, summary)
works as expected.
Andy
> From: Gabor Grothendieck
>
> I noticed that, unlike similar functions, 'by' does not use
> match.
I noticed that, unlike similar functions, 'by' does not use match.fun, e.g.
> by(iris, iris$Species, "summary")
Error in FUN(X[[1]], ...) : couldn't find function "FUN"
The 'by' code should have an initial line of:
FUN <- match.fun(FUN)
__
R-devel@r-p
32 matches
Mail list logo