Displaying 20 results from an estimated 200 matches similar to: "dplyr/summarize does not create a true data frame"
2024 Nov 23
2
dplyr summarize by groups
# Get mean, min, max sigma and skew by group
options (digits = 3)
library (ISwR
data(energy)
data %>%
group_by(stature) %>%
summarize(
Mean = mean(expend),
Min = min(expend),
Max = max(expend),
Sigma = sd(expend),
Skew = skew(expend))
# Output
stature Mean Min Max Sigma Skew
<fct> <dbl> <dbl> <dbl> <dbl> <dbl>
1
2011 Jun 17
3
rle on large data . . . without a for loop!
I think need to do something like this:
dat<-data.frame(state=sample(id=rep(1:5,each=200),1:3, 1000,
replace=T,prob=c(0.7,0.05,0.25)),V1=runif(1,10,1000),V2=rnorm(1000))
rle.dat<-rle(dat$state)
temp<-1
out<-data.frame(id=1:length(rle.dat$length))
for(i in 1:length(rle.dat$length)){
temp2<-temp+rle.dat$length[[i]]
out$V1[i]<-mean(dat$V1[temp:temp2])
2006 May 05
0
summarize: A log analysis script
Hi folks,
I wrote a quick script to extract performance one-liners from Rails logs.
(Didn''t want to futz with syslog for http://rails-analyzer.rubyforge.org/ .)
Reads output from :info or :debug log levels (the defaults).
Usage:
# summarize < development.log
# summarize < production.log
Output looks like:
(w/FULL_URL set false)
123.23.23.123 2006-05-05 10:59:42 | r
2014 Nov 13
2
Help with ddply/summarize
I have a straightforward application of ddply() and summarize():
ddply(MyFrame, .(Treatment, Week), summarize, MeanValue=mean(MyVar))
This works just fine:
Treatment Week MeanValue
1 MyDrug BASELINE 5.91
2 MyDrug WEEK 1 4.68
3 MyDrug WEEK 2 4.08
4 MyDrug WEEK 3 3.67
5 MyDrug WEEK 4 2.96
6 MyDrug WEEK 5 2.57
7 MyDrug
2004 Jul 13
0
Is there a statistics that can summarize the correlation formore than two random variables?
This seems more like a STATS question than an R question - asking on a
list like STAT-L or ALLSTAT may result in more replies
Nevertheless, it seems to me that you need to describe (and maybe
decide) what you mean by 'summarize' the correlations. Certainly the
mean DOES summarize them, but is it the summary you want? Maybe, maybe
not. Perhaps the median? Or a trimmed mean? Do you want
2006 Apr 19
1
Hmisc + summarize + quantile: Why only quantiles for first variable in data frame?
Hi,
I'm working on a data set that contains a couple of factors and a
number of dependent variables. From all of these dependent variables
I would like to calculate mean, standard deviation and quantiles.
With the function FUN I get all the means and stdev that I want but
quantiles are only calculated for the first of the dependent
variables (column 8 in the summarize command). What do I
2009 Mar 31
1
summarize logical string
Hello everyone,
I am a newbie, working on a gene clustering problem, and I have problems
in summarizing a logical string into number of repeats of each value. In
other words, how could I obtain from
0 1 1 1 0 0 0 0 1 1 0 1 0 0
this: 1 3 4 2 1 1 2
so a string that gives me the number of repeated values, no matter zeros
or ones.
I've been diving in the manuals and the mailing list but,
2009 Apr 24
0
By= levels with the Hmisc summarize function.
Hi, All
I have a data frame as follows:
> attach(mf)
> names(mf)
[1] "centre" "complex" "appl" "pool" "month" "alloc_gb"
I want to summarize this as follows:
agg<-summarize(alloc_gb,by=llist(centre,complex,appl,month),FUN=sum,
na.rm=TRUE)
That seems to run fine but there something odd about the output. The
2010 Apr 13
0
Hmisc::summarize with a dataframe as input?
Hi all,
I'm looking for a function with the same functionalities as Hmisc::summarize
but accepting a dataframe as input (not just a vector or a matrix).
I'd like to compute the correlation between two variables in my dataframe,
grouped according to other variables in the same dataframe.
For exemple, consider the following dataframe D:
V1 V2 V3
A 1 -1
A 1 1
A -1 -1
2012 Aug 10
1
summarize a vector
I have a long numeric vector v (length N) and I want create a shorter
vector of length N/k consisting of sums of k-subsequences of v:
v <- c(1,2,3,4,5,6,7,8,9,10)
N=10, k=3
===> [6,15,24,10]
I can, of course, iterate:
> w <- vector(mode="numeric",length=ceiling(N/k))
> for (i in 1:length(w)) w[i] <- sum(v(i*k:(i+1)*k))
(modulo boundary conditions)
but I wonder if
2009 Jun 13
1
Hmisc summarize() with level "" in by variable
I was using summarize() in a data set in which one of the levels of
the by variable was "". The summary statistic was consistently off by
one level and the "" level was not in the output data frame. I tried
to report it as a bug, but I could not log into the Hmisc bug
reporting website to do so. I searched for this in the email
archives. If it's there, I failed to find
2004 Jul 13
2
Is there a statistics that can summarize the correlation for more than two random variables?
Hi, R people,
I wonder if there is a statistics than can measure the correlation for more
than two random variables, instead of computing the correlation coefficient
matrix. If so, what R package should I use?
Right now I can only think of the mean of all pair-wise correlation
coefficients, e.g., (corr(x,y) + corr(x,z) + corr(y,z)) / 3 for three random
variables (x, y, z).
Thanks a
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,
+
2008 Apr 25
1
Summarize data for MCA (FactoMineR)
Hi :-)
I'm new to R and I started using it for a project (I'm the CS guy in a group
of statisticians helping them find out how to solve issues as they come out).
This is my first post to the list and I am starting to learn R.
Well, they were used to doing MCA analysis in other programs where the data
seems to be preprocessed automatically before running MCA.
So, they need to process a
2006 Dec 28
2
Aggregation using list with Hmisc summarize function
Hi All,
I'm using the Hmisc summarize function and used list instead of llist to
provide the by variables. It generated an error message. Is this a bug,
or do I misunderstand how Hmisc works with lists? The program below
demonstrates the error message.
Thanks,
Bob
x<-1:8
group <- c(1,1,1,1,2,2,2,2)
gender<- c(1,2,1,2,1,2,1,2)
mydata<-data.frame(x,group,gender)
2017 Nov 25
0
dplyr - add/expand rows
I have a returned tibble of station operational record similar to the following:
> data.collection
# A tibble: 5 x 4
STATION_NUMBER YEAR_FROM YEAR_TO RECORD
<chr> <int> <int> <chr>
1 07EA001 1960 1960 QMS
2 07EA001 1961 1970 QMC
3 07EA001 1971 1971 QMM
4 07EA001 1972 1976 QMC
5
2017 Nov 26
0
dplyr - add/expand rows
> On Nov 25, 2017, at 11:18 AM, Hutchinson, David (EC) <david.hutchinson at canada.ca> wrote:
>
> I have a returned tibble of station operational record similar to the following:
>
>> data.collection
> # A tibble: 5 x 4
> STATION_NUMBER YEAR_FROM YEAR_TO RECORD
> <chr> <int> <int> <chr>
> 1 07EA001 1960
2020 Oct 15
1
Dplyr question
Hi All,
Trying to get familiar with dplyr so I have a basic question:
How to summarise sum(Values) per species, maintaining Code column (each species has a Code):
Species Values Code
1 Acanthocybium solandri 33 LC
2 Makaira nigricans 20 VU
3 Makaira nigricans 20 VU
4. Makaira nigricans
2017 Oct 30
2
R: dplyr, doBy, and ggplot2 in CentOS7
I have a R script that I am running from python with rpy2. On a debian
system I run this:
apt-get install R-cran-ggplot2 R-cran-caret
And the script works. I want to move this to CentOS 7 system. There it
cannot find R-cran-ggplot2 or R-cran-caret. Does anyone know what
packages in CentOS 7 I need for dplyr, doBy, and ggplot2?
2017 Oct 30
0
R: dplyr, doBy, and ggplot2 in CentOS7
On Mon, Oct 30, 2017 at 10:27 AM, Larry Martell <larry.martell at gmail.com>
wrote:
> I have a R script that I am running from python with rpy2. On a debian
> system I run this:
>
> apt-get install R-cran-ggplot2 R-cran-caret
>
> And the script works. I want to move this to CentOS 7 system. There it
> cannot find R-cran-ggplot2 or R-cran-caret. Does anyone know what