Re: [R] max & min values within dataframe

2011-11-14 Thread B Laura
Thanks for these various tips. Sarah, this is not a howework, but a simplified dataset speecificly for this question. Laura . 2011/11/14 Dennis Murphy > Groupwise data summarization is a very common task, and it is worth > learning the various ways to do it in R. Josh showed you one way to > u

Re: [R] max & min values within dataframe

2011-11-14 Thread Dennis Murphy
Groupwise data summarization is a very common task, and it is worth learning the various ways to do it in R. Josh showed you one way to use aggregate() from the base package and Michael showed you one way of using the plyr package to do the same; another way would be ddply(df, .(Patient, Region),

Re: [R] max & min values within dataframe

2011-11-14 Thread R. Michael Weylandt
I took a stab at this using ddply() from the plyr package. How's this look to you? x<- textConnection("Col Patient Region Score Time 11 X19 28 21 X20 126 31 X22 100 41 X25 191 52 Y121 62 Y

Re: [R] max & min values within dataframe

2011-11-14 Thread Joshua Wiley
Hi Laura, You were close. Just use range() instead of min/max: ## your data (read in and then pasted the output of dput() to make it easy) dat <- structure(list(Patient = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L,

Re: [R] max & min values within dataframe

2011-11-14 Thread Sarah Goslee
Hi Laura, This looks suspiciously like homework. Nonetheless, you may wish to check out ?cbind. Sarah On Mon, Nov 14, 2011 at 11:10 AM, B Laura wrote: > dear R-team > > I need to find the min, max values for each patient from dataset and keep > the output of it as a dataframe with the following

[R] max & min values within dataframe

2011-11-14 Thread B Laura
dear R-team I need to find the min, max values for each patient from dataset and keep the output of it as a dataframe with the following columns - Patient nr - Region (remains same per patient) - Min score - Max score Patient Region Score Time 11 X19 28 21