search for: summarising

Displaying 20 results from an estimated 589 matches for "summarising".

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 =
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, +
2017 Sep 09
0
Avoid duplication in dplyr::summarise
Hi Lars I am not very sure what you really want. However, I am suggesting the following code that enables (1) to obtain the full summary of your data and (2) retrieve only mean of X values as function of factors f1 and f2. library(tidyverse) library(psych) df <- data.frame(matrix(rnorm(40), 10, 4), f1 = gl(3, 10, labels = letters[1:3]), f2 = gl(3, 10, labels
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
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 Nabble.com.
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,...
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 =
2012 Sep 18
2
Formula in a data-frame
Hello all, I'm new in R, and I have a data-frame like this (dput information below): Specie Fooditem Occurrence Volume 1 Schizodon vegetal 1 0.05 2 Schizodon sediment 1 0.60 3 Schizodon vegetal 1 0.15 4 Schizodon alga 1 0.05 5 Schizodon sediment 1 0.90 6 Schizodon
2018 Feb 10
2
Optimizar función
Buenas para tod en s, tengo una consulta para poder optimizar tiempos. Ejemplo tengo el siguiente dataframe: distrito<-c("A","A","A","B","B","B","C","C","C","A","A","B","B","C")
2004 Apr 06
1
Ignorant lack of bliss : summarise table by column attribute
Having read the list posting guidelines I fear my first post is about to break the rules. Apologies in advance. We have been asked to produce some graphs of relative performance of 3 groups of people in relation to the trend of their previous performance. I am neither a mathematician or a statistician, but wondered if R (which I have been using as a desktop calculator!) and some knowledge from
2009 Mar 15
0
How to summarise several models in a single table
Dear R-helpers, I have produced 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
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
If you show us, not just tell us about, a self-contained example someone might show you a non-hacky way of getting the job done. (I don't see an argument to plyr::ddply called 'transform'.) Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Apr 19, 2016 at 12:18 PM, Michael Artz <michaeleartz at gmail.com> wrote: > Oh thanks for that clarification Bert! Hope you enjoyed
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
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
2012 Jul 24
1
Function for ddply
Hello, all. I'm new to R and just beginning to learn to write functions. I know I'm out of my depth posting here, and I'm sure my issue is mundane. But here goes. I'm analyzing the American National Election Study (nes), looking 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
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) )
2016 Apr 20
2
Interquartile Range
Well, instead of your functions try: Mode <- function(x) { tabx <- table(x) tabx[which.max(tabx)] } and use R's IQR function instead of yours. ... so I still don't get why you want to return a character string instead of a value for the IQR; and the mode of a sample defined as above is generally a bad estimator of the mode of the distribution. To say more than that would
2024 Sep 17
1
(no subject)
Hmmm... typos and thinkos ? Maybe: mean_narm<- function(x) { m <- mean(x, na.rm = T) if (is.nan (m)) NA else m } -- Bert On Mon, Sep 16, 2024 at 4:40?PM CALUM POLWART <polc1410 at gmail.com> wrote: > > Rui's solution is good. > > Bert's suggestion is also good! > > For Berts suggestion you'd make the list bit > > list(mean = mean_narm) >