Displaying 3 results from an estimated 3 matches for "mbn1".
Did you mean:
man1
2011 Oct 05
2
aggregate function with a dataframe for both "x" and "by"
...mydata using the corresponding column in mybys.
Please see the example below. What is a more elegant or "better" way to
accomplish this task?
Thanks!
mydata = data.frame(testvar1=c(1,3,5,7,8,3,5,NA,4,5,7,9),
testvar2=c(11,33,55,77,88,33,55,NA,44,55,77,99)
)
mybys=data.frame(mbn1=c('red','blue',1,2,NA,'big',1,2,'red',1,NA,12),mbn2=c('wet','dry',99,95,NA,'damp',95,99,'red',99,NA,NA)
, stringsAsFactors =F)
myaggs <- data.frame(matrix(data=NA, nrow=nrow(mydata), ncol=ncol(mydata) )
)
for(i in 1: ncol(myda...
2007 Jul 31
1
aggregate.data.frame - prevent conversion to factors? show statistics for NA values of "by" variable?
...39;big',1,2,'red',1,NA,12)
myby2=c('wet','dry',99,95,NA,'damp',95,99,'red',99,NA,NA)
myby1.new = ifelse(is.na(myby1)==T,"is_na",myby1)
myby2.new = ifelse(is.na(myby2)==T,"is_na",myby2)
str(myby1.new)
str(myby2.new)
mybys=data.frame(mbn1=myby1.new,mbn2=myby2.new , stringsAsFactors =F)
str(mybys)
#
myagg1 = aggregate(x=mydf, by=mybys, FUN='mean')
str(myagg1)
myagg2 = myagg1
myagg2[1:ncol(mybys)] = as.character(unlist(myagg1[1:ncol(mybys)]))
str(myagg2)
myagg1
myagg2
---------------------------------
[[alterna...
2015 Apr 30
2
Sieve Rule: What am I missing here?
...14-02-07) on mta.openssl.org
X-Spam-Level:
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,RCVD_IN_MSPIKE_H4,
RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0
X-Greylist: delayed 471 seconds by postgrey-1.34 at mta;
Thu, 30 Apr 2015 18:54:10 UTC
Received: from mtx6.mbn1.net (mtx6.mbn1.net [213.188.129.253])
(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mta.openssl.org (Postfix) with ESMTPS id 51E1920135
for <openssl-users at openssl.org>; Thu, 30 Apr 2015 18:54:10 +0000 (UTC)
From: m.de.groot <...