Try this:

> require(sqldf)
> x <- read.fwf(textConnection("4 - 4       56
+ 4 - 3       61
+ 3 - 3       300
+ 3 - 3        27
+ 3 - 3       33
+ 3 - 3       87
+ 3 - 4      49
+ 4 - 4      71
+ 4 - 3     121
+ 3 - 4     138
+ 4 - 3      15"), width = c(7,8) , header = FALSE, as.is = TRUE)
> closeAllConnections()
> sqldf("
+     select V1
+             , count(*) as Freq
+             , min(V2) as Min
+             , max(V2) as Max
+             , median(V2) as Median
+         from x
+         group by V1
+ ")
       V1 Freq Min Max Median
1 3 - 3      4  27 300   60.0
2 3 - 4      2  49 138   93.5
3 4 - 3      3  15 121   61.0
4 4 - 4      2  56  71   63.5
>


On Tue, Mar 13, 2012 at 5:45 AM, RMSOPS <ricardosousa2...@clix.pt> wrote:
> Hello
>
>   I am developing a small program that to calculate the maximum, minimum
> and average.
>
>    The data.frame v is
>
> POS       DIF
> 4 - 4       56
> 4 - 3       61
> 3 - 3       300
> 3 - 3        27
> 3 - 3       33
> 3 - 3       87
> 3 - 4      49
> 4 - 4      71
> 4 - 3     121
> 3 - 4     138
> 4 - 3      15
>
>
> When execute  res<-table(df$v) gives this
>
> Var1    Freq
> 4 - 4      2
> 4 - 3      3
> 3 - 3     3
> 3 - 4     2
> 4 - 4    1
>
> If possible, my idea is that the result often present in addition to the
> minimum, maximum and average, all in a single array, for example.
>   what is the quickest way to do this
>
> Var1    Freq  Min    Max Med
> 4 - 4      2      56         71  ....
> 4 - 3      3      15       121
> 3 - 3     3      ....        .....
> 3 - 4     2     ...            ...
> 4 - 4    1    ...             ....
>
> Thanks
>
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Matrix-Results-tp4468642p4468642.html
> Sent from the R help mailing list archive at Nabble.com.
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to