Displaying 20 results from an estimated 592 matches for "summarise".
Did you mean:
summaries
2017 Sep 09
2
Avoid duplication in dplyr::summarise
Dear group,
Is there a way I could avoid the sort of duplication illustrated below?
i.e., I have the same dplyr::summarise function on different group_by
arguments. So I'd like to create a single summarise function that could be
applied to both. My attempt below fails.
df <- data.frame(matrix(rnorm(40), 10, 4),
f1 = gl(3, 10, labels = letters[1:3]),
f2 = gl(3, 10, labels = lett...
2009 Sep 25
2
summarize-plyr package
Hi,I am using the amazing package 'plyr". I have one problem. I would
appreciate help to fix the following error: Thanks.
______________________________
> library(plyr)
> data(baseball)
> summarise(baseball,
+ duration = max(year) - min(year),
+ nteams = length(unique(team)))
Error: could not find function "summarise"
> ddply(baseball, "id", summarise,
+ duration = max(year) - min(year),
+ nteams = length(unique(team)))
Error in llply(.data = .data, .fun = .fun, ..., .p...
2017 Sep 09
0
Avoid duplication in dplyr::summarise
...ig hilsen/ Best regards
Edjabou Maklawe Essonanawe Vincent
Mobile: +45 31 95 99 33
On Sat, Sep 9, 2017 at 12:30 PM, Lars Bishop <lars52r at gmail.com> wrote:
> Dear group,
>
> Is there a way I could avoid the sort of duplication illustrated below?
> i.e., I have the same dplyr::summarise function on different group_by
> arguments. So I'd like to create a single summarise function that could be
> applied to both. My attempt below fails.
>
> df <- data.frame(matrix(rnorm(40), 10, 4),
> f1 = gl(3, 10, labels = letters[1:3]),
>...
2017 Sep 09
1
Avoid duplication in dplyr::summarise
Hi Lars,
Two comments:
1. You can achieve what you want with a slight modification of your
definition of s(), using the hint from the error message that you need an
argument '.':
s <- function(.) {
dplyr::summarise(., x1m = mean(X1),
x2m = mean(X2),
x3m = mean(X3),
x4m = mean(X4))
}
2. You have not given a great test case in how you set your two factors
because the two group_by()'s will give the identical groupings, An
alternative which confirms th...
2011 Apr 11
1
read in summarised data as table()
I have some summarised data from a 2D pivot table which I want to visualise
in R. How can I read in the data as a R table so I can use mosaicplot()?
Dirk
--
View this message in context: http://r.789695.n4.nabble.com/read-in-summarised-data-as-table-tp3442283p3442283.html
Sent from the R help mailing list archive at N...
2009 Jul 28
2
aggregating strings
I am currently summarising a data set by collapsing data based on common identifiers in a column. I am using the 'aggregate' function to summarise numeric columns, i.e. "aggregate(dat[,3], list(dat$gene), mean)". I also wish to summarise text columns e.g. by concatenating values in a comma separated list, but the aggregate function can only return scalar values and so something like "aggregate(dat[,3], list(dat$gene), cat)&quo...
2017 Sep 08
2
quote()/eval() question
Dear list,
For a reason it would take me long to explain, I need to do something along
the lines of what's shown below -- i.e., create an object from
dplyr::summarise, and then evaluate it on a data frame.
I know I could directly do:
df %>% dplyr::summarise(x1_mean = mean(x1))
but this is not what I'm looking for.
library(dplyr)
df <- data.frame(x1 = rnorm(100), x2 = rnorm(100))
foo <- function(df) {
mySummary <- quote(dplyr::summarise...
2012 Sep 18
2
Formula in a data-frame
...)
Fi = percentual frequency of occurrence of a food item
Vi = percentual volume of a food item
So, using ddply (plyr) function, I was able to calculate the total
frequency of occurrence and total volume of each food item, using:
Frequency = ddply (dieta, c('Specie','Fooditem') , summarise,
Frequency = sum (Occurrence))
Volume = ddply (dieta, c('Specie','Fooditem') , summarise, Volume =
sum (Volume))
and calculate total frequency and total volume for a given specie:
TFrequency = ddply (Frequency, 'Specie' , summarise, TF = sum (Frequency))
TVolume = ddply...
2018 Feb 10
2
Optimizar función
...quot;F")
Edad<-c(25,36,25,25,25,19,36,39,36,65,54,25,28,28)
Ingreso<-c(125,365,265,987,690,369,325,369,789,854,254,268,698,258)
Aporte <- c(3,6,3,6,9,6,9,7,9,7,4,8,2,8)
datos<-data.frame(distrito=distrito,Sex=Sex,Edad=Edad,Ingreso=Ingreso,Aporte=Aporte)
Quiero aplicar la function *summarise *del paquete *dplyr *a las 3
variables númericas.
Para la variable Aporte por ejemplo:
descrip<-function(data) {
grupos <- group_by(data, distrito)
result <-
summarise(grupos,
media = mean(Aporte),
maximo = max(Aporte),
minimo = min(Apor...
2004 Apr 06
1
Ignorant lack of bliss : summarise table by column attribute
...results$finalreading
[1] -1.4 6.9 1.1 3.4 0.0 3.6 -3.8 0.1 -0.1 0.9 1.2 -3.4 -1.5 0.1 5.6
[16] -3.3 -1.9 0.9 -3.1 1.5 0.7 -1.6 -0.3 1.1 -0.1 -0.6 1.5 0.2 0.8 -1.0
[31] 0.8 -0.5 1.9 -4.0 -3.3 3.1 2.8 -0.6 1.2 2.0 -1.9 -1.6 -1.1 -3.9 NA
...
Aims:
- Summarise these by groups (I can't work out how to use tapply...)
- Produce a sensible 'typification' of each group's change in
relation to the projected figure. I assume this would use a
statistical algorithm to exclude exceptions.
- Plot the 3 'typifications' in...
2009 Mar 15
0
How to summarise several models in a single table
...oduced several models, named model1, model2, model3, etc...
I would like to extract several elements from each model's object, e.g. at
minimum the estimates, SEs, and P values of each model's intercept and
slopes, model R-squared, and AIC...
...and then produce a new object (a table) that summarises all of my models,
with M\models in rows and extractd model elements in columns.
Before reinventing the wheel, I wonder if there is a package or function
that does what I need?
Thank you!
Mark Na
[[alternative HTML version deleted]]
2013 Jan 22
2
summarise subsets of a vector
Hello,
I have vector called test. And now I wish to measure the mean of the first
10 number, the second 10 numbers etc
How does it work?
Thanks Wim
> dput (test)
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.71, 0.21875, 0,
2007 Aug 16
0
summarising systemfit with saveMemory
Hi all -
I'm on R 2.5.1 for XP.
in the systemfit package, the summary is set to print the McElroy's
measure of fit unless it's NULL. When the option saveMemory = TRUE,
the McElroy isn't included, instead it defaults to NA. Thus I am
unable to use summary.systemfit.
> library(systemfit)
> example(systemfit)
> surfit2 <-
2016 Apr 19
2
Interquartile Range
...chael Artz <michaeleartz at gmail.com>
wrote:
> Oh thanks for that clarification Bert! Hope you enjoyed your coffee! I
> ended up just using the transform argument in the ddply function. It
> worked and it repeated, then I called a mode function in another call to
> ddply that summarised. Kinda hacky but oh well!
>
> On Tue, Apr 19, 2016 at 12:31 PM, Bert Gunter <bgunter.4567 at gmail.com>
> wrote:
>
>> ... and I'm getting another cup of coffee...
>>
>> -- Bert
>> Bert Gunter
>>
>> "The trouble with having an open min...
2016 Apr 19
0
Interquartile Range
Hi,
Here is what I am doing
notGroupedAll <- ddply(data
,~groupColumn
,summarise
,col1_mean=mean(col1)
,col2_mode=Mode(col2) #Function I wrote for getting the
mode shown below
,col3_Range=myIqr(col3)
)
groupedAll <- ddply(data
,~groupColumn
,summarise
,col1...
2003 Mar 14
3
logistic regression
Hello
1*
I need to use logistic regression. But
my data file is very huge( appx. 4 million line).
R doesn't handle such a file.
What can I do ?
------------------------
2*
So, I thought whether I could perform sta. analyses on summarised
data (count of yes/no values) of the huge file. Normally, summarised
data file short and R could handle it.
Then I used this command.
> lo <-glm(hey.count~as.factor(jeo)+as.factor(eg)+as.factor(kon)+
as.factor(yol)+ as.factor(aks)+as.factor(fay),family=poisson,data=dt2)
as you see I used c...
2012 Jul 24
1
Function for ddply
...king at mean values of a numeric dep_var (environ.therm) across values
of a factor (partyid3). I use ddply from plyr and wtd.mean from Hmisc. The
nes requires a weight var (wt). I use Rcmdr's plotMeans to obtain a line
chart. The following code works:
attach(nes)
obj1 = ddply(nes, .(partyid3), summarise,
var = wtd.mean(environ.therm, wt))
print(obj1)
plotMeans(obj1$var, obj1$partyid3, error.bars="none")
Here is what happens when I write and run the function, meanN:
meanN=function(data,x,y,w=NULL)
+ {obj1=ddply(data,.(x),summarise, var=wtd.mean(y,w))
+ print(obj1)
+ plotMeans(obj1$...
2013 Apr 03
5
Can package plyr also calculate the mode?
I am trying to replicate the SAS proc univariate in R. I got most of the
stats I needed for a by grouping in a data frame using:
all1 <- ddply(all,"ACT_NAME", summarise, mean=mean(COUNTS), sd=sd(COUNTS),
q25=quantile(COUNTS,.25),median=quantile(COUNTS,.50),
q75=quantile(COUNTS,.75),
q90=quantile(COUNTS,.90), q95=quantile(COUNTS,.95),
q99=quantile(COUNTS,.99) )
So I got the mean, median std dev, quantiles etc.
IS there any way I can add th...
2016 Apr 20
2
Interquartile Range
...s (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Apr 19, 2016 at 4:25 PM, Michael Artz <michaeleartz at gmail.com> wrote:
> Hi,
> Here is what I am doing
>
> notGroupedAll <- ddply(data
> ,~groupColumn
> ,summarise
> ,col1_mean=mean(col1)
> ,col2_mode=Mode(col2) #Function I wrote for getting the
> mode shown below
> ,col3_Range=myIqr(col3)
> )
>
> groupedAll <- ddply(data
> ,~groupColumn
>...
2024 Sep 17
1
(no subject)
..., 8, 3, 2, 5,
> > >> 20, 12, 6, 4, 6, 7, 16, 7, 3, 7, 8, 20, 6)),
> > >> class = "data.frame", row.names = c(NA, -25L))
> > >>
> > >>
> > >>
> > >> As for the problem, I am not sure if you want summarise instead of
> > >> mutate but here is a summarise solution.
> > >>
> > >>
> > >>
> > >> library(dplyr)
> > >>
> > >> db10 %>%
> > >> group_by(groupid) %>%
> > >> summarise(across...