Displaying 5 results from an estimated 5 matches for "x2m".
Did you mean:
p2m
2017 Sep 09
2
Avoid duplication in dplyr::summarise
...unction 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 = letters[4:6]))
df %>%
group_by(f1, f2) %>%
summarise(x1m = mean(X1),
x2m = mean(X2),
x3m = mean(X3),
x4m = mean(X4))
df %>%
group_by(f1) %>%
summarise(x1m = mean(X1),
x2m = mean(X2),
x3m = mean(X3),
x4m = mean(X4))
# My fail attempt
s <- function() {
dplyr::summarise(x1m = mean(X1),...
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 that the function s() does what you want mig...
2017 Sep 09
0
Avoid duplication in dplyr::summarise
...pt below fails.
>
> df <- data.frame(matrix(rnorm(40), 10, 4),
> f1 = gl(3, 10, labels = letters[1:3]),
> f2 = gl(3, 10, labels = letters[4:6]))
>
>
> df %>%
> group_by(f1, f2) %>%
> summarise(x1m = mean(X1),
> x2m = mean(X2),
> x3m = mean(X3),
> x4m = mean(X4))
>
> df %>%
> group_by(f1) %>%
> summarise(x1m = mean(X1),
> x2m = mean(X2),
> x3m = mean(X3),
> x4m = mean(X4))
>
> # My fail attempt
>
> s &l...
2005 Jul 13
3
samba-3.0.20pre2 rpms very BIG
Hi,
I just downloaded the fedora samba-3.0.20pre2 source rpm. I built the
binary RPM's using the rpmbuild -bb samba-spec command. I hav'nt
installed the new rpm's yet but noticed they are much bigger than
previous rpms. see below:
-rw-r--r-- 1 root root 23M Jun 14 20:12 samba-3.0.14a-4.i386.rpm
-rw-r--r-- 1 root root 25M Jun 30 19:04 samba-3.0.20pre1-1.i386.rpm
-rw-r--r-- 1
2011 Mar 27
6
Asking Favor For the Script of Median Filter
Hello,everybody. My name is Chuan Zun Liang. I come from Malaysia. I am just
a beginner for R. Kindly to ask favor about median filter. The problem I
facing as below:
> x<-matrix(sample(1:30,25),5,5)
> x
[,1] [,2] [,3] [,4] [,5]
[1,] 7 8 30 29 13
[2,] 4 6 12 5 9
[3,] 25 3 22 14 24
[4,] 2 15 26 23 19
[5,] 28 18 10 11 20
This