Hi all,
Here is my situation. I have a dataframe, the structure would be something
like this,
TestData-data.frame(ID=rep(1:10,each=10),TIME=rep(seq(0.1,1,0.1),10),VAR1=rnorm(100),VAR2=5*rnorm(100),VAR3=10*rnorm(100))
Basically, I want to extract the maximum value from each ID for VAR1, VAR2,
How about
aggregate(TestData[,c('VAR1','VAR2','VAR3')], by=list(id=TestData$ID),
FUN=max)
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 6/20/14 12:42 PM, Jun Shen jun.shen...@gmail.com wrote:
Hi all,
Here is my
Have you looked at the 'aggregate' function? E.g.,
aggregate(TestData[c(VAR1,VAR2,VAR3)], by=TestData[ID], max)
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Jun 20, 2014 at 12:42 PM, Jun Shen jun.shen...@gmail.com wrote:
Hi all,
Here is my situation. I have a dataframe, the
You could try:
library(plyr)
res - ddply(TestData[,-2],.(ID),numcolwise(max))
colnames(res)[-1] - paste0(colnames(res)[-1],.max)
A.K.
On Friday, June 20, 2014 3:43 PM, Jun Shen jun.shen...@gmail.com wrote:
Hi all,
Here is my situation. I have a dataframe, the structure would be something
Hi Don, Bill and A.K.
Thanks for your reply. It worked!
On Fri, Jun 20, 2014 at 3:56 PM, arun smartpink...@yahoo.com wrote:
You could try:
library(plyr)
res - ddply(TestData[,-2],.(ID),numcolwise(max))
colnames(res)[-1] - paste0(colnames(res)[-1],.max)
A.K.
On Friday, June 20, 2014
5 matches
Mail list logo